@vtx/map 1.1.48 → 1.1.50

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.
Files changed (65) hide show
  1. package/lib/VtxMap/AMap/AMap.js +1007 -639
  2. package/lib/VtxMap/AMap/AMap.js.map +1 -1
  3. package/lib/VtxMap/BMap/Map.js +1201 -755
  4. package/lib/VtxMap/BMap/Map.js.map +1 -1
  5. package/lib/VtxMap/GMap/Map.js +1569 -1053
  6. package/lib/VtxMap/GMap/Map.js.map +1 -1
  7. package/lib/VtxMap/Map.js +42 -8
  8. package/lib/VtxMap/Map.js.map +1 -1
  9. package/lib/VtxMap/MapToolFunction.js +63 -26
  10. package/lib/VtxMap/MapToolFunction.js.map +1 -1
  11. package/lib/VtxMap/OMap/Map.js +1365 -873
  12. package/lib/VtxMap/OMap/Map.js.map +1 -1
  13. package/lib/VtxMap/OlMap/Map.js +1280 -760
  14. package/lib/VtxMap/OlMap/Map.js.map +1 -1
  15. package/lib/VtxMap/TMap/TMap.js +1063 -658
  16. package/lib/VtxMap/TMap/TMap.js.map +1 -1
  17. package/lib/VtxMap/index.js +8 -1
  18. package/lib/VtxMap/index.js.map +1 -1
  19. package/lib/VtxMap/mapPlayer.js +123 -67
  20. package/lib/VtxMap/mapPlayer.js.map +1 -1
  21. package/lib/VtxMap/optimizingPointMap.js +79 -23
  22. package/lib/VtxMap/optimizingPointMap.js.map +1 -1
  23. package/lib/VtxMap/style/css.js +6 -0
  24. package/lib/VtxMap/style/css.js.map +1 -1
  25. package/lib/VtxMap/style/index.js +6 -0
  26. package/lib/VtxMap/style/index.js.map +1 -1
  27. package/lib/VtxMap/zoomMap.js +43 -14
  28. package/lib/VtxMap/zoomMap.js.map +1 -1
  29. package/lib/VtxModal/VtxModal.js +65 -21
  30. package/lib/VtxModal/VtxModal.js.map +1 -1
  31. package/lib/VtxModal/draggableModal.js +50 -14
  32. package/lib/VtxModal/draggableModal.js.map +1 -1
  33. package/lib/VtxModal/index.js +6 -1
  34. package/lib/VtxModal/index.js.map +1 -1
  35. package/lib/VtxModal/style/css.js +6 -0
  36. package/lib/VtxModal/style/css.js.map +1 -1
  37. package/lib/VtxModal/style/index.js +6 -0
  38. package/lib/VtxModal/style/index.js.map +1 -1
  39. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js +240 -107
  40. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js.map +1 -1
  41. package/lib/VtxSearchCheckMap/index.js +2 -0
  42. package/lib/VtxSearchCheckMap/index.js.map +1 -1
  43. package/lib/VtxSearchCheckMap/mapping.js +2 -1
  44. package/lib/VtxSearchCheckMap/mapping.js.map +1 -1
  45. package/lib/VtxSearchCheckMap/style/css.js +19 -0
  46. package/lib/VtxSearchCheckMap/style/css.js.map +1 -1
  47. package/lib/VtxSearchCheckMap/style/index.js +19 -0
  48. package/lib/VtxSearchCheckMap/style/index.js.map +1 -1
  49. package/lib/VtxSearchMap/VtxSearchMap.js +234 -95
  50. package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
  51. package/lib/VtxSearchMap/index.js +2 -0
  52. package/lib/VtxSearchMap/index.js.map +1 -1
  53. package/lib/VtxSearchMap/mapping.js +2 -1
  54. package/lib/VtxSearchMap/mapping.js.map +1 -1
  55. package/lib/VtxSearchMap/style/css.js +19 -0
  56. package/lib/VtxSearchMap/style/css.js.map +1 -1
  57. package/lib/VtxSearchMap/style/index.js +19 -0
  58. package/lib/VtxSearchMap/style/index.js.map +1 -1
  59. package/lib/default.js +19 -4
  60. package/lib/default.js.map +1 -1
  61. package/lib/index.js +3 -0
  62. package/lib/index.js.map +1 -1
  63. package/lib/utils/util.js +17 -5
  64. package/lib/utils/util.js.map +1 -1
  65. package/package.json +1 -1
@@ -1,80 +1,135 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _reactDom = require("react-dom");
13
+
10
14
  var _MapToolFunction = require("../MapToolFunction");
15
+
11
16
  var _immutable = _interopRequireDefault(require("immutable"));
17
+
12
18
  var _default2 = _interopRequireWildcard(require("../../default"));
13
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
15
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
16
26
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
27
+
17
28
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
29
+
18
30
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+
19
32
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
+
20
34
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
35
+
21
36
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
23
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+
38
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
+
40
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
41
+
42
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43
+
44
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
+
26
46
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
47
+
48
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
49
+
28
50
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
30
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
51
+
31
52
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
53
+
32
54
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
55
+
33
56
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
57
+
34
58
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
59
+
35
60
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
61
+
36
62
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
63
+
37
64
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
38
- var Set = _immutable["default"].Set;
39
- //公共地址配置
65
+
66
+ var Set = _immutable["default"].Set; //公共地址配置
67
+
40
68
  var TMap = /*#__PURE__*/function (_React$Component) {
41
69
  _inherits(TMap, _React$Component);
70
+
42
71
  var _super = _createSuper(TMap);
72
+
43
73
  function TMap(props) {
44
74
  var _this;
75
+
45
76
  _classCallCheck(this, TMap);
46
- _this = _super.call(this, props);
47
- //初始化 图元管理方法
77
+
78
+ _this = _super.call(this, props); //初始化 图元管理方法
79
+
48
80
  _this.GM = new _MapToolFunction.graphicManage();
49
81
  _this.getPolygonArea = _MapToolFunction.getPolygonArea;
50
82
  _this.pointCollectionId = 'vtx_gmap_html_pointCollection'; //海量点canvas点位容器id class管理
83
+
51
84
  _this.isNotClickMap = false; //阻止点击事件冒泡到地图
85
+
52
86
  _this.isZoom = false; //阻止 zoom事件后触发的移动事件
87
+
53
88
  _this.mapLeft = 0; //地图offset的Left值
89
+
54
90
  _this.mapTop = 0; //地图offset的Top值
91
+
55
92
  _this.clusterObj = null; //聚合对象
93
+
56
94
  _this.clusterMarkers = null; //聚合的点集合
95
+
57
96
  _this.markerTool = null; //绘制点对象
97
+
58
98
  _this.polylineTool = null; //绘制线对象
99
+
59
100
  _this.polygonTool = null; //绘制面对象
101
+
60
102
  _this.rectangleTool = null; //绘制矩形对象
103
+
61
104
  _this.circleTool = null; //绘制圆对象
105
+
62
106
  _this.isEditId = null; //记录当前编辑的id,过滤移入移出事件
107
+
63
108
  _this.moveToTimer = null; //moveTo时间对象
109
+
64
110
  _this.timer = 10; //动画播放频率
111
+
65
112
  _this.movePoints = []; //move点的对象集合
113
+
66
114
  _this.morepoints = []; //海量点集合
115
+
67
116
  _this.heatmap = null; //热力图对象
117
+
68
118
  _this.animTimer = {}; //点位跳动动画
119
+
69
120
  _this.animCount = {}; //点位跳动动画 位置记录
121
+
70
122
  _this.waitInit = null; //等加载定时
123
+
71
124
  _this.isLoading = false; //是否加载完
125
+
72
126
  _this.waitReceive = null; //等初始化,更新定时
127
+
128
+ _this.mapCreated = false;
73
129
  _this.state = {
74
130
  gis: null,
75
131
  //地图对象
76
132
  mapId: props.mapId,
77
- mapCreated: false,
78
133
  pointIds: [],
79
134
  //地图上点的ids
80
135
  lineIds: [],
@@ -102,9 +157,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
102
157
  controlStyle: 'lt'
103
158
  };
104
159
  _this.frameSelectProps = {};
160
+
105
161
  _this.loadMapJs();
162
+
106
163
  return _this;
107
164
  }
165
+
108
166
  _createClass(TMap, [{
109
167
  key: "loadMapJs",
110
168
  value: function loadMapJs() {
@@ -114,7 +172,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
114
172
  resolve(window.T);
115
173
  } else {
116
174
  $.getScript("".concat(_default2["default"].mapServerURL, "/T_content.js"), function () {
117
- $.getScript("//api.tianditu.gov.cn/api?v=4.0&tk=".concat((0, _default2.getTMapTK)()), function () {
175
+ $.getScript(_default2["default"].tmapScriptUrl, function () {
118
176
  var Heatmap = new Promise(function (resolve, reject) {
119
177
  //对象问题 和arcgis使用不同的热力图
120
178
  $.getScript("".concat(_default2["default"].mapServerURL, "/Theatmap.js"), function () {
@@ -130,16 +188,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
130
188
  $.getScript("".concat(_default2["default"].mapServerURL, "/TImageOverlay.js"), function () {
131
189
  resolve();
132
190
  });
133
- });
134
- // let components = new Promise((resolve,reject)=>{
191
+ }); // let components = new Promise((resolve,reject)=>{
135
192
  // $.getScript(`${configUrl.mapServerURL}/T_toolComponents.js`,()=>{
136
193
  // resolve();
137
194
  // })
138
195
  // });
139
- Promise.all([Heatmap, PointCollection, ImageOverlays /*,components*/]).then(function () {
196
+
197
+ Promise.all([Heatmap, PointCollection, ImageOverlays
198
+ /*,components*/
199
+ ]).then(function () {
140
200
  if (t.waitInit) {
141
201
  clearInterval(t.waitInit);
142
202
  }
203
+
143
204
  t.waitInit = setInterval(function () {
144
205
  if (T.Tool) {
145
206
  clearInterval(t.waitInit);
@@ -157,126 +218,141 @@ var TMap = /*#__PURE__*/function (_React$Component) {
157
218
  value: function init() {
158
219
  var t = this;
159
220
  var _t$props = t.props,
160
- mapPoints = _t$props.mapPoints,
161
- mapLines = _t$props.mapLines,
162
- mapPolygons = _t$props.mapPolygons,
163
- mapCircles = _t$props.mapCircles,
164
- setVisiblePoints = _t$props.setVisiblePoints,
165
- mapVisiblePoints = _t$props.mapVisiblePoints,
166
- mapCenter = _t$props.mapCenter,
167
- mapZoomLevel = _t$props.mapZoomLevel,
168
- mapCluster = _t$props.mapCluster,
169
- mapPointCollection = _t$props.mapPointCollection,
170
- showControl = _t$props.showControl,
171
- boundaryName = _t$props.boundaryName,
172
- areaRestriction = _t$props.areaRestriction,
173
- heatMapData = _t$props.heatMapData,
174
- imageOverlays = _t$props.imageOverlays,
175
- coverageType = _t$props.coverageType,
176
- infoWindowData = _t$props.infoWindowData;
177
- //创建地图
178
- t.createMap();
179
- // 切换地图矢量图和卫星图背景
221
+ mapPoints = _t$props.mapPoints,
222
+ mapLines = _t$props.mapLines,
223
+ mapPolygons = _t$props.mapPolygons,
224
+ mapCircles = _t$props.mapCircles,
225
+ setVisiblePoints = _t$props.setVisiblePoints,
226
+ mapVisiblePoints = _t$props.mapVisiblePoints,
227
+ mapCenter = _t$props.mapCenter,
228
+ mapZoomLevel = _t$props.mapZoomLevel,
229
+ mapCluster = _t$props.mapCluster,
230
+ mapPointCollection = _t$props.mapPointCollection,
231
+ showControl = _t$props.showControl,
232
+ boundaryName = _t$props.boundaryName,
233
+ areaRestriction = _t$props.areaRestriction,
234
+ heatMapData = _t$props.heatMapData,
235
+ imageOverlays = _t$props.imageOverlays,
236
+ coverageType = _t$props.coverageType,
237
+ infoWindowData = _t$props.infoWindowData; //创建地图
238
+
239
+ t.createMap(); // 切换地图矢量图和卫星图背景
240
+
180
241
  if (coverageType) {
181
242
  t.setMapType(coverageType);
182
- }
183
- //添加点
243
+ } //添加点
244
+
245
+
184
246
  if (mapPoints instanceof Array) {
185
247
  t.addPoint(mapPoints);
186
- }
187
- //添加线
248
+ } //添加线
249
+
250
+
188
251
  if (mapLines instanceof Array) {
189
252
  t.addLine(mapLines);
190
- }
191
- // //添加面
253
+ } // //添加面
254
+
255
+
192
256
  if (mapPolygons instanceof Array) {
193
257
  t.addPolygon(mapPolygons);
194
- }
195
- //添加圆
258
+ } //添加圆
259
+
260
+
196
261
  if (mapCircles instanceof Array) {
197
262
  t.addCircle(mapCircles);
198
- }
199
- //添加图片图层
263
+ } //添加图片图层
264
+
265
+
200
266
  if (imageOverlays instanceof Array) {
201
267
  t.imageUrlOverlay(imageOverlays);
202
268
  }
203
269
  /*设置指定图元展示*/
270
+
271
+
204
272
  if (mapVisiblePoints) {
205
273
  t.setVisiblePoints(mapVisiblePoints);
206
- }
207
- // 画热力图
274
+ } // 画热力图
275
+
276
+
208
277
  if (heatMapData) {
209
278
  t.heatMapOverlay(heatMapData);
210
- }
211
- // 打开信息窗体
279
+ } // 打开信息窗体
280
+
281
+
212
282
  if (infoWindowData) {
213
283
  t.infoWindow(infoWindowData);
214
- }
215
- //添加海量点
284
+ } //添加海量点
285
+
286
+
216
287
  if (mapPointCollection instanceof Array) {
217
288
  setTimeout(function () {
218
289
  t.addPointCollection(mapPointCollection);
219
290
  }, 100);
220
- }
221
- //设置比例尺
291
+ } //设置比例尺
292
+
293
+
222
294
  if (mapZoomLevel) {
223
295
  t.setZoomLevel(mapZoomLevel);
224
- }
225
- //设置点聚合
296
+ } //设置点聚合
297
+
298
+
226
299
  if (mapCluster) {
227
300
  t.cluster(mapCluster);
228
- }
229
- // //展示比例尺
301
+ } // //展示比例尺
302
+
303
+
230
304
  if (showControl) {
231
305
  t.showControl();
232
- }
233
- //添加地图类型控件
306
+ } //添加地图类型控件
307
+
308
+
234
309
  if (t.props.satelliteSwitch) {
235
310
  t.showMapTypeControl();
236
- }
237
- // //画边界线
311
+ } // //画边界线
238
312
  // if(boundaryName instanceof Array && boundaryName.length>0){
239
313
  // t.addBaiduBoundary(boundaryName);
240
314
  // }
241
-
242
315
  //设置区域限制
316
+
317
+
243
318
  if (areaRestriction && !!areaRestriction[0] && !!areaRestriction[1]) {
244
319
  t.setAreaRestriction(areaRestriction);
245
- }
246
- //初始化地图拖拽开始事件
247
- t.dragMapStart();
248
- //初始化地图拖拽结束事件
249
- t.dragMapEnd();
250
- //初始化地图移动开始事件
251
- t.moveStart();
252
- //初始化地图移动结束事件
253
- t.moveEnd();
254
- //初始化地图zoom改变开始事件
255
- t.zoomStart();
256
- //初始化地图zoom改变结束事件
257
- t.zoomEnd();
258
- //初始化地图点击事件
320
+ } //初始化地图拖拽开始事件
321
+
322
+
323
+ t.dragMapStart(); //初始化地图拖拽结束事件
324
+
325
+ t.dragMapEnd(); //初始化地图移动开始事件
326
+
327
+ t.moveStart(); //初始化地图移动结束事件
328
+
329
+ t.moveEnd(); //初始化地图zoom改变开始事件
330
+
331
+ t.zoomStart(); //初始化地图zoom改变结束事件
332
+
333
+ t.zoomEnd(); //初始化地图点击事件
334
+
259
335
  t.clickMap();
260
- t.setState({
261
- mapCreated: true
262
- });
336
+ this.mapCreated = true;
263
337
  }
264
338
  }, {
265
339
  key: "createMap",
266
340
  value: function createMap() {
267
341
  var t = this;
268
342
  var _t$props2 = t.props,
269
- mapStyle = _t$props2.mapStyle,
270
- _t$props2$mapCenter = _t$props2.mapCenter,
271
- mapCenter = _t$props2$mapCenter === void 0 ? [] : _t$props2$mapCenter,
272
- mapId = _t$props2.mapId,
273
- mapZoomLevel = _t$props2.mapZoomLevel,
274
- minZoom = _t$props2.minZoom,
275
- maxZoom = _t$props2.maxZoom;
343
+ mapStyle = _t$props2.mapStyle,
344
+ _t$props2$mapCenter = _t$props2.mapCenter,
345
+ mapCenter = _t$props2$mapCenter === void 0 ? [] : _t$props2$mapCenter,
346
+ mapId = _t$props2.mapId,
347
+ mapZoomLevel = _t$props2.mapZoomLevel,
348
+ minZoom = _t$props2.minZoom,
349
+ maxZoom = _t$props2.maxZoom;
350
+
276
351
  if (!window.VtxMap) {
277
352
  window.VtxMap = {};
278
- }
279
- // 控件位置常量
353
+ } // 控件位置常量
354
+
355
+
280
356
  t.AnchorConstant = {
281
357
  tr: T_ANCHOR_TOP_RIGHT,
282
358
  tl: T_ANCHOR_TOP_LEFT,
@@ -291,10 +367,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
291
367
  minZoom: minZoom || 1,
292
368
  maxZoom: maxZoom || 18
293
369
  });
370
+
294
371
  if (mapStyle) {
295
372
  t.state.gis.setStyle(mapStyle);
296
- }
297
- //海量点图元容器
373
+ } //海量点图元容器
374
+
375
+
298
376
  t.pointCollectionId = "".concat(mapId, "_").concat(t.pointCollectionId);
299
377
  var pointCollectionDiv = document.createElement('div');
300
378
  pointCollectionDiv.id = t.pointCollectionId;
@@ -302,41 +380,46 @@ var TMap = /*#__PURE__*/function (_React$Component) {
302
380
  pointCollectionDiv.className = 'vtx_gmap_html_pointCollection_t';
303
381
  $(t.state.gis.getPanes().mapPane.children[0]).before(pointCollectionDiv);
304
382
  t.initPropsForUser();
305
- }
306
- // 初始化对外方法
383
+ } // 初始化对外方法
384
+
307
385
  }, {
308
386
  key: "initPropsForUser",
309
387
  value: function initPropsForUser() {
310
388
  var t = this;
389
+
311
390
  t.state.gis["frameSelect"] = function () {
312
391
  var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
313
392
  var callback = arguments.length > 1 ? arguments[1] : undefined;
314
393
  return t.frameSelect(obj, callback);
315
394
  };
395
+
316
396
  t.state.gis["clearFrameSelect"] = function () {
317
397
  return t.clearFrameSelect();
318
398
  };
399
+
319
400
  t.state.gis["clearFrameSelectById"] = function (id) {
320
401
  return t.clearFrameSelectById(id);
321
402
  };
322
- }
323
- // 框选
403
+ } // 框选
404
+
324
405
  }, {
325
406
  key: "frameSelect",
326
407
  value: function frameSelect(_ref, callback) {
327
408
  var geometryType = _ref.geometryType,
328
- _ref$parameter = _ref.parameter,
329
- parameter = _ref$parameter === void 0 ? {} : _ref$parameter,
330
- _ref$data = _ref.data,
331
- data = _ref$data === void 0 ? {} : _ref$data;
409
+ _ref$parameter = _ref.parameter,
410
+ parameter = _ref$parameter === void 0 ? {} : _ref$parameter,
411
+ _ref$data = _ref.data,
412
+ data = _ref$data === void 0 ? {} : _ref$data;
413
+
332
414
  if (!['polygon', 'circle', 'rectangle'].includes(geometryType)) {
333
415
  message.warn("传入的类型不支持框选!");
334
416
  return false;
335
417
  }
418
+
336
419
  var t = this;
337
420
  var params = {},
338
- type = geometryType || 'polygon',
339
- id = data.id || "frameSelectFeature_".concat(Math.random());
421
+ type = geometryType || 'polygon',
422
+ id = data.id || "frameSelectFeature_".concat(Math.random());
340
423
  params.color = parameter.color || 'red';
341
424
  params.lineColor = parameter.lineColor || 'red';
342
425
  params.lineOpacity = parameter.lineOpacity || 1;
@@ -355,17 +438,18 @@ var TMap = /*#__PURE__*/function (_React$Component) {
355
438
  id: id,
356
439
  type: geometryType
357
440
  };
358
- }
359
- // 清除框选
441
+ } // 清除框选
442
+
360
443
  }, {
361
444
  key: "clearFrameSelect",
362
445
  value: function clearFrameSelect() {
363
446
  for (var key in this.frameSelectProps) {
364
447
  this.removeGraphic(this.frameSelectProps[key].id, this.frameSelectProps[key].type);
365
448
  }
449
+
366
450
  this.frameSelectProps = {};
367
- }
368
- // 清除框选ById
451
+ } // 清除框选ById
452
+
369
453
  }, {
370
454
  key: "clearFrameSelectById",
371
455
  value: function clearFrameSelectById(id) {
@@ -380,62 +464,67 @@ var TMap = /*#__PURE__*/function (_React$Component) {
380
464
  case 'sl':
381
465
  this.state.gis.setMapType(TMAP_NORMAL_MAP);
382
466
  break;
467
+
383
468
  case 'wx':
384
469
  this.state.gis.setMapType(TMAP_HYBRID_MAP);
385
470
  break;
386
471
  }
387
- }
388
- //增加图片图层
472
+ } //增加图片图层
473
+
389
474
  }, {
390
475
  key: "imageUrlOverlay",
391
476
  value: function imageUrlOverlay(imageAry) {
392
477
  var t = this;
393
478
  imageAry.map(function (item, index) {
394
479
  var sw = item.sw,
395
- ne = item.ne,
396
- url = item.url,
397
- opacity = item.opacity,
398
- displayOnMinLevel = item.displayOnMinLevel,
399
- displayOnMaxLevel = item.displayOnMaxLevel;
480
+ ne = item.ne,
481
+ url = item.url,
482
+ opacity = item.opacity,
483
+ displayOnMinLevel = item.displayOnMinLevel,
484
+ displayOnMaxLevel = item.displayOnMaxLevel;
485
+
400
486
  if (!url) {
401
487
  console.warn("\u56FE\u7247\u56FE\u5C42url\u6570\u636E\u9519\u8BEF");
402
488
  return false;
403
489
  }
490
+
404
491
  if (sw && ne && Array.isArray(sw) && Array.isArray(ne) && sw[0] && sw[1] && ne[0] && ne[1]) {
405
492
  var swnep = new T.LngLatBounds(new T.LngLat(sw[0], sw[1]), new T.LngLat(ne[0], ne[1])),
406
- imageUrlOverlay = new T.ImageOverlay(url, swnep, {
407
- minZoom: displayOnMinLevel || 3,
408
- maxZoom: displayOnMaxLevel || 18
409
- });
493
+ imageUrlOverlay = new T.ImageOverlay(url, swnep, {
494
+ minZoom: displayOnMinLevel || 3,
495
+ maxZoom: displayOnMaxLevel || 18
496
+ });
410
497
  t.state.gis.addOverLay(imageUrlOverlay);
411
498
  } else {
412
499
  console.warn("\u533A\u57DF\u7ECF\u7EAC\u5EA6sw/ne\u6570\u636E\u9519\u8BEF");
413
500
  return false;
414
501
  }
415
502
  });
416
- }
417
- //清空地图所有图元
503
+ } //清空地图所有图元
504
+
418
505
  }, {
419
506
  key: "clearAll",
420
507
  value: function clearAll() {
421
- var t = this;
422
- //清空热力图
508
+ var t = this; //清空热力图
509
+
423
510
  if (t.heatmap) {
424
511
  t.heatmap.clear();
425
512
  }
426
- t.heatmap = null;
427
- //先清除所有标记
513
+
514
+ t.heatmap = null; //先清除所有标记
515
+
428
516
  if (t.clusterMarkers) {
429
517
  t.clusterObj.removeMarkers(t.clusterMarkers);
430
518
  }
431
- t.clearAllPointCollection();
432
- //清空点
519
+
520
+ t.clearAllPointCollection(); //清空点
521
+
433
522
  t.state.gis.getOverlays().map(function (item, index) {
434
523
  t.state.gis.removeOverLay(item);
435
- });
436
- //清空缓存数据
437
- t.GM.clearAll();
438
- //清空历史数据记录
524
+ }); //清空缓存数据
525
+
526
+ t.GM.clearAll(); //清空历史数据记录
527
+
439
528
  t.setState({
440
529
  pointIds: [],
441
530
  lineIds: [],
@@ -453,13 +542,16 @@ var TMap = /*#__PURE__*/function (_React$Component) {
453
542
  }
454
543
  /*set方法*/
455
544
  //设置地图中心位置 lng/经度 lat/纬度
545
+
456
546
  }, {
457
547
  key: "setCenter",
458
548
  value: function setCenter(gt) {
459
549
  var t = this;
550
+
460
551
  if (!t.state.gis) {
461
552
  return;
462
553
  }
554
+
463
555
  if (gt) {
464
556
  t.state.gis.centerAndZoom(new T.LngLat(gt[0], gt[1]), t.state.gis.getZoom());
465
557
  } else {
@@ -467,6 +559,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
467
559
  }
468
560
  }
469
561
  /*地图区域限制*/
562
+
470
563
  }, {
471
564
  key: "setAreaRestriction",
472
565
  value: function setAreaRestriction(sw_ne) {
@@ -478,18 +571,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
478
571
  key: "clearAreaRestriction",
479
572
  value: function clearAreaRestriction() {
480
573
  this.state.gis.setMaxBounds(null);
481
- }
482
- //设置指定图元展示 高德只有zoom和center全适应,单适应暂时无法实现
574
+ } //设置指定图元展示 高德只有zoom和center全适应,单适应暂时无法实现
575
+
483
576
  }, {
484
577
  key: "setVisiblePoints",
485
578
  value: function setVisiblePoints(obj) {
486
579
  var t = this;
487
580
  var ls = [];
488
581
  var _t$state = t.state,
489
- pointIds = _t$state.pointIds,
490
- lineIds = _t$state.lineIds,
491
- polygonIds = _t$state.polygonIds,
492
- circleIds = _t$state.circleIds;
582
+ pointIds = _t$state.pointIds,
583
+ lineIds = _t$state.lineIds,
584
+ polygonIds = _t$state.polygonIds,
585
+ circleIds = _t$state.circleIds;
586
+
493
587
  var getLngLats = function getLngLats(ids) {
494
588
  var alnglat = [];
495
589
  t.GM.getMoreGraphic(ids).map(function (item, index) {
@@ -499,44 +593,55 @@ var TMap = /*#__PURE__*/function (_React$Component) {
499
593
  case 2:
500
594
  alnglat.push(item.getLngLat());
501
595
  break;
596
+
502
597
  case 4:
503
598
  alnglat.push.apply(alnglat, _toConsumableArray(item.getLngLats()));
504
599
  break;
600
+
505
601
  case 5:
506
602
  //多边形 返回的是 三维数组
507
603
  alnglat.push.apply(alnglat, _toConsumableArray(item.getLngLats()[0]));
508
604
  break;
605
+
509
606
  case 8:
510
607
  alnglat.push(item.getCenter());
511
608
  break;
512
609
  }
513
610
  });
514
611
  return alnglat;
515
- };
516
- //算出 要展示的图元点位
612
+ }; //算出 要展示的图元点位
613
+
614
+
517
615
  switch (obj.fitView) {
518
616
  case 'point':
519
617
  ls = getLngLats(pointIds);
520
618
  break;
619
+
521
620
  case 'line':
522
621
  ls = getLngLats(lineIds);
523
622
  break;
623
+
524
624
  case 'polygon':
525
625
  ls = getLngLats(polygonIds);
526
626
  break;
627
+
527
628
  case 'circle':
528
629
  ls = getLngLats(circleIds);
529
630
  break;
631
+
530
632
  case 'all':
531
633
  ls = getLngLats([].concat(_toConsumableArray(pointIds), _toConsumableArray(lineIds), _toConsumableArray(polygonIds), _toConsumableArray(circleIds)));
532
634
  break;
635
+
533
636
  default:
534
637
  var ids = [];
638
+
535
639
  if (obj.fitView instanceof Array) {
536
640
  ids = obj.fitView;
537
641
  } else if (typeof obj.fitView === 'string') {
538
642
  ids = obj.fitView.split(',');
539
643
  }
644
+
540
645
  if (ids[0] instanceof Array) {
541
646
  ls = ids.map(function (item) {
542
647
  return new T.LngLat(item[0], item[1]);
@@ -544,12 +649,15 @@ var TMap = /*#__PURE__*/function (_React$Component) {
544
649
  } else {
545
650
  ls = getLngLats(ids);
546
651
  }
652
+
547
653
  break;
548
654
  }
655
+
549
656
  if (ls.length >= 1) {
550
657
  var _t$state$gis$getViewp = t.state.gis.getViewport(ls),
551
- center = _t$state$gis$getViewp.center,
552
- zoom = _t$state$gis$getViewp.zoom;
658
+ center = _t$state$gis$getViewp.center,
659
+ zoom = _t$state$gis$getViewp.zoom;
660
+
553
661
  if (obj.type == 'zoom') {
554
662
  t.setZoomLevel(zoom);
555
663
  } else if (obj.type == 'center') {
@@ -558,16 +666,15 @@ var TMap = /*#__PURE__*/function (_React$Component) {
558
666
  t.state.gis.centerAndZoom(center, zoom);
559
667
  }
560
668
  }
561
- }
669
+ } //设置地图比例尺
562
670
 
563
- //设置地图比例尺
564
671
  }, {
565
672
  key: "setZoomLevel",
566
673
  value: function setZoomLevel(zoom) {
567
674
  var t = this;
568
675
  t.state.gis.centerAndZoom(t.state.gis.getCenter(), zoom);
569
- }
570
- //获取当前地图的中心位置
676
+ } //获取当前地图的中心位置
677
+
571
678
  }, {
572
679
  key: "getCurrentCenter",
573
680
  value: function getCurrentCenter() {
@@ -576,15 +683,15 @@ var TMap = /*#__PURE__*/function (_React$Component) {
576
683
  lat: t.state.gis.getCenter().lat,
577
684
  lng: t.state.gis.getCenter().lng
578
685
  };
579
- }
580
- //获取当前比例尺
686
+ } //获取当前比例尺
687
+
581
688
  }, {
582
689
  key: "getZoomLevel",
583
690
  value: function getZoomLevel() {
584
691
  var t = this;
585
692
  return t.state.gis.getZoom();
586
- }
587
- //获取当前地图边框左右边角经纬度,中心点位置,和比例尺,半径距离
693
+ } //获取当前地图边框左右边角经纬度,中心点位置,和比例尺,半径距离
694
+
588
695
  }, {
589
696
  key: "getMapExtent",
590
697
  value: function getMapExtent() {
@@ -608,13 +715,14 @@ var TMap = /*#__PURE__*/function (_React$Component) {
608
715
  };
609
716
  obj.radius = t.calculatePointsDistance([obj.nowCenter.lng, obj.nowCenter.lat], [gis.getBounds().getNorthEast().getLng(), gis.getBounds().getNorthEast().getLat()]);
610
717
  return obj;
611
- }
612
- //聚合地图图元(arg为空时聚合全部点)
718
+ } //聚合地图图元(arg为空时聚合全部点)
719
+
613
720
  }, {
614
721
  key: "cluster",
615
722
  value: function cluster(arg) {
616
723
  var t = this;
617
724
  var ary = [];
725
+
618
726
  if (!arg) {
619
727
  var pointIds = t.state.pointIds;
620
728
  ary = pointIds;
@@ -625,18 +733,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
625
733
  ary = arg.split(',');
626
734
  }
627
735
  }
736
+
628
737
  var ms = this.GM.getMoreGraphic(ary).filter(function (item, index) {
629
738
  // return !item && item != 0 ? false : true;
630
739
  return item && item.getType() === 2 && !item.label;
631
- });
632
- //聚合的对象,便于后期清除时调用
740
+ }); //聚合的对象,便于后期清除时调用
741
+
633
742
  this.clusterObj = new T.MarkerClusterer(t.state.gis, {
634
743
  markers: ms
635
- });
636
- //记录聚合的点,便于后期清除
744
+ }); //记录聚合的点,便于后期清除
745
+
637
746
  this.clusterMarkers = ms;
638
- }
639
- // 清除聚合
747
+ } // 清除聚合
748
+
640
749
  }, {
641
750
  key: "removeCluster",
642
751
  value: function removeCluster(arg) {
@@ -645,44 +754,47 @@ var TMap = /*#__PURE__*/function (_React$Component) {
645
754
  t.clusterObj.removeMarkers(t.clusterObj.options.markers);
646
755
  ids.map(function (id) {
647
756
  t.GM.removeGraphic(id);
648
- });
649
- // 重新加点
757
+ }); // 重新加点
758
+
650
759
  t.addPoint(t.props.mapPoints);
651
- }
652
- //设置比例尺
760
+ } //设置比例尺
761
+
653
762
  }, {
654
763
  key: "showControl",
655
764
  value: function showControl(props) {
656
765
  var t = this,
657
- location = t.AnchorConstant['tr'],
658
- offset = null,
659
- scaleOffset = null;
766
+ location = t.AnchorConstant['tr'],
767
+ offset = null,
768
+ scaleOffset = null;
660
769
  var config = props || t.props;
770
+
661
771
  if (t.scaleControl) {
662
772
  t.state.gis.removeControl(t.scaleControl);
663
773
  }
774
+
664
775
  if (t.navigationControl) {
665
776
  t.state.gis.removeControl(t.navigationControl);
666
777
  }
778
+
667
779
  if (config.showControl.location) {
668
780
  location = t.AnchorConstant[config.showControl.location];
669
- }
670
- // 添加比例尺
781
+ } // 添加比例尺
782
+
783
+
671
784
  var control = new T.Control.Scale({
672
785
  position: location,
673
786
  offset: scaleOffset
674
787
  });
675
788
  t.state.gis.addControl(control);
676
- t.scaleControl = control;
677
- // 缩放地图
789
+ t.scaleControl = control; // 缩放地图
790
+
678
791
  var navigation = new T.Control.Zoom({
679
792
  position: location,
680
793
  offset: offset
681
794
  });
682
795
  t.state.gis.addControl(navigation);
683
- t.navigationControl = navigation;
796
+ t.navigationControl = navigation; // TODO不支持偏移,手动偏移
684
797
 
685
- // TODO不支持偏移,手动偏移
686
798
  if (config.showControl.offset && config.showControl.offset.length > 0) {
687
799
  if (location == "topright") {
688
800
  $('div.tdt-top.tdt-right').css({
@@ -706,46 +818,48 @@ var TMap = /*#__PURE__*/function (_React$Component) {
706
818
  });
707
819
  }
708
820
  }
709
- }
821
+ } // 移除比例尺
710
822
 
711
- // 移除比例尺
712
823
  }, {
713
824
  key: "removeControl",
714
825
  value: function removeControl() {
715
826
  var t = this;
827
+
716
828
  if (t.scaleControl) {
717
829
  t.state.gis.removeControl(t.scaleControl);
718
830
  t.scaleControl = null;
719
831
  }
832
+
720
833
  if (t.navigationControl) {
721
834
  t.state.gis.removeControl(t.navigationControl);
722
835
  t.navigationControl = null;
723
836
  }
724
- }
837
+ } //展示地图切换控件
725
838
 
726
- //展示地图切换控件
727
839
  }, {
728
840
  key: "showMapTypeControl",
729
841
  value: function showMapTypeControl(props) {
730
842
  var t = this,
731
- location = t.AnchorConstant['br'],
732
- offset = null;
843
+ location = t.AnchorConstant['br'],
844
+ offset = null;
733
845
  var config = props || t.props;
846
+
734
847
  if (t.mapTypeControl) {
735
848
  t.state.gis.removeControl(t.mapTypeControl);
736
849
  }
850
+
737
851
  if (config.satelliteSwitch.location) {
738
852
  location = t.AnchorConstant[config.satelliteSwitch.location];
739
- }
740
- // 地图切换控件
853
+ } // 地图切换控件
854
+
855
+
741
856
  var control = new T.Control.MapType({
742
857
  position: location,
743
858
  offset: offset
744
859
  });
745
860
  t.state.gis.addControl(control);
746
- t.mapTypeControl = control;
861
+ t.mapTypeControl = control; // TODO不支持偏移,手动偏移
747
862
 
748
- // TODO不支持偏移,手动偏移
749
863
  if (config.satelliteSwitch.offset && config.satelliteSwitch.offset.length > 0) {
750
864
  if (location == "topright") {
751
865
  $('div.tdt-top.tdt-right').css({
@@ -769,22 +883,23 @@ var TMap = /*#__PURE__*/function (_React$Component) {
769
883
  });
770
884
  }
771
885
  }
772
- }
773
- //测距
886
+ } //测距
887
+
774
888
  }, {
775
889
  key: "vtxRangingTool",
776
890
  value: function vtxRangingTool() {
777
891
  var _this2 = this;
778
- var t = this;
779
- //将map对象放到全局中.是因为天地图api中使用了全局map.(坑B)
780
- window.map = t.state.gis;
781
- //创建标注工具对象
892
+
893
+ var t = this; //将map对象放到全局中.是因为天地图api中使用了全局map.(坑B)
894
+
895
+ window.map = t.state.gis; //创建标注工具对象
896
+
782
897
  var lineTool = new T.PolylineTool(t.state.gis, {
783
898
  showLabel: true
784
899
  });
785
900
  lineTool.open();
786
- this.isNotClickMap = true;
787
- //监听每次点击事件,阻止地图点击事件冒泡
901
+ this.isNotClickMap = true; //监听每次点击事件,阻止地图点击事件冒泡
902
+
788
903
  lineTool.addEventListener('addpoint', function () {
789
904
  _this2.isNotClickMap = true;
790
905
  });
@@ -798,24 +913,29 @@ var TMap = /*#__PURE__*/function (_React$Component) {
798
913
  });
799
914
  }
800
915
  });
801
- }
802
- //获取图元数据
916
+ } //获取图元数据
917
+
803
918
  }, {
804
919
  key: "getGraphic",
805
920
  value: function getGraphic(id) {
806
921
  var t = this;
922
+
807
923
  if (!id) {
808
924
  return false;
809
925
  }
926
+
810
927
  var gp = t.GM.getGraphicParam(id);
811
928
  var gg = t.GM.getGraphic(id);
929
+
812
930
  if (!gg) {
813
931
  return false;
814
932
  }
933
+
815
934
  var p = {},
816
- pts = [],
817
- lng = 0,
818
- lat = 0;
935
+ pts = [],
936
+ lng = 0,
937
+ lat = 0;
938
+
819
939
  switch (gp.geometryType) {
820
940
  case 'point':
821
941
  lng = gg.getLngLat().getLng();
@@ -836,6 +956,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
836
956
  })
837
957
  });
838
958
  break;
959
+
839
960
  case 'polyline':
840
961
  pts = gg.getLngLats().map(function (item, index) {
841
962
  return [item.lng, item.lat];
@@ -853,6 +974,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
853
974
  })
854
975
  });
855
976
  break;
977
+
856
978
  case 'polygon':
857
979
  pts = gg.getLngLats()[0].map(function (item, index) {
858
980
  return [item.lng, item.lat];
@@ -870,6 +992,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
870
992
  })
871
993
  });
872
994
  break;
995
+
873
996
  case 'circle':
874
997
  lng = gg.getCenter().getLng();
875
998
  lat = gg.getCenter().getLat();
@@ -894,15 +1017,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
894
1017
  });
895
1018
  break;
896
1019
  }
1020
+
897
1021
  return p;
898
- }
899
- //添加点
1022
+ } //添加点
1023
+
900
1024
  }, {
901
1025
  key: "addPoint",
902
1026
  value: function addPoint(mapPoints, type) {
903
1027
  var _this3 = this;
1028
+
904
1029
  var t = this;
1030
+
905
1031
  var psids = _toConsumableArray(t.state.pointIds);
1032
+
906
1033
  mapPoints.map(function (item, index) {
907
1034
  var cg = {
908
1035
  width: 33,
@@ -914,17 +1041,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
914
1041
  markerContentY: -33,
915
1042
  zIndex: 100,
916
1043
  deg: 0
917
- };
918
- //如果id重复,直接跳过不执行.
1044
+ }; //如果id重复,直接跳过不执行.
1045
+
919
1046
  if (_this3.GM.isRepetition(item.id)) {
920
1047
  console.warn("\u52A0\u70B9id: ".concat(item.id, " \u91CD\u590D"));
921
1048
  return false;
922
- }
923
- //点位数据不符合,直接跳过
1049
+ } //点位数据不符合,直接跳过
1050
+
1051
+
924
1052
  if (!item.longitude || !item.latitude) {
925
1053
  console.warn("\u70B9 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
926
1054
  return false;
927
1055
  }
1056
+
928
1057
  if (item.markerContent) {
929
1058
  cg = _objectSpread(_objectSpread({}, cg), {}, {
930
1059
  markerContentX: 0,
@@ -932,52 +1061,57 @@ var TMap = /*#__PURE__*/function (_React$Component) {
932
1061
  width: 100,
933
1062
  height: 30
934
1063
  });
935
- }
936
- //初始化默认数据
1064
+ } //初始化默认数据
1065
+
1066
+
937
1067
  if (item.config) {
938
1068
  cg = _objectSpread(_objectSpread({}, cg), item.config);
939
- }
940
- //覆盖物参数
1069
+ } //覆盖物参数
1070
+
1071
+
941
1072
  var markerOption = {
942
1073
  zIndexOffset: cg.zIndex,
943
1074
  opacity: 1
944
1075
  };
945
- var marker = null;
946
- //判断html还是图片
1076
+ var marker = null; //判断html还是图片
1077
+
947
1078
  if (!!item.markerContent) {
948
1079
  markerOption.icon = new T.Icon({
949
1080
  iconUrl: item.url || "".concat(_default2["default"].mapServerURL, "/images/touming.png"),
950
1081
  iconSize: new T.Point(cg.width, cg.height),
951
1082
  iconAnchor: new T.Point(-cg.markerContentX, -cg.markerContentY)
952
1083
  });
1084
+
953
1085
  if (cg.zIndex !== undefined || cg.zIndex !== null) {
954
1086
  markerOption.zIndexOffset = cg.zIndex;
955
- }
956
- //获得覆盖物对象
1087
+ } //获得覆盖物对象
1088
+
1089
+
957
1090
  marker = new T.Marker(new T.LngLat(item.longitude, item.latitude), markerOption);
958
- t.state.gis.addOverLay(marker);
959
- //-12,+15测试的阈值
1091
+ t.state.gis.addOverLay(marker); //-12,+15测试的阈值
1092
+
960
1093
  marker.label = new T.Label({
961
1094
  text: item.markerContent,
962
1095
  offset: new T.Point(cg.markerContentX - 12, cg.markerContentY + 15)
963
1096
  });
964
- marker.showLabel();
965
- //统一加点
1097
+ marker.showLabel(); //统一加点
966
1098
  } else {
967
1099
  markerOption.icon = new T.Icon({
968
1100
  iconUrl: item.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
969
1101
  iconSize: new T.Point(cg.width, cg.height),
970
1102
  iconAnchor: new T.Point(-cg.markerContentX, -cg.markerContentY)
971
1103
  });
1104
+
972
1105
  if (cg.zIndex !== undefined || cg.zIndex !== null) {
973
1106
  markerOption.zIndexOffset = cg.zIndex;
974
- }
975
- //获得覆盖物对象
976
- marker = new T.Marker(new T.LngLat(item.longitude, item.latitude), markerOption);
977
- //添加点击事件
1107
+ } //获得覆盖物对象
1108
+
1109
+
1110
+ marker = new T.Marker(new T.LngLat(item.longitude, item.latitude), markerOption); //添加点击事件
978
1111
  //统一加点
979
- t.state.gis.addOverLay(marker);
980
- //是否展示label
1112
+
1113
+ t.state.gis.addOverLay(marker); //是否展示label
1114
+
981
1115
  if (item.canShowLabel) {
982
1116
  var labelClass = item.labelClass || 'label-content';
983
1117
  marker.label = new T.Label({
@@ -986,17 +1120,20 @@ var TMap = /*#__PURE__*/function (_React$Component) {
986
1120
  });
987
1121
  marker.showLabel();
988
1122
  }
989
- }
990
- //点跳动动画
1123
+ } //点跳动动画
1124
+
1125
+
991
1126
  if (!item.markerContent && cg.BAnimationType == 0) {
992
1127
  t.pointAnimation(item.id, marker);
993
1128
  } else {
994
1129
  t.pointAnimation(item.id, null);
995
1130
  }
1131
+
996
1132
  if (cg.deg) {
997
1133
  marker.getElement().style.transform = marker.getElement().style.transform + " rotate(".concat(cg.deg, "deg)");
998
1134
  marker.getElement().style['-ms-transform'] = " rotate(".concat(cg.deg, "deg)");
999
1135
  }
1136
+
1000
1137
  marker.addEventListener('click', function (e) {
1001
1138
  t.clickGraphic(item.id, e);
1002
1139
  });
@@ -1006,8 +1143,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1006
1143
  marker.addEventListener('mouseout', function (e) {
1007
1144
  t.mouseOutGraphic(item.id, e);
1008
1145
  });
1009
- psids.push(item.id);
1010
- //缓存图元的数据,偏于后期操作
1146
+ psids.push(item.id); //缓存图元的数据,偏于后期操作
1147
+
1011
1148
  _this3.GM.setGraphic(item.id, marker).setGraphicParam(item.id, {
1012
1149
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1013
1150
  other: item
@@ -1021,18 +1158,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1021
1158
  deg: cg.deg
1022
1159
  });
1023
1160
  });
1161
+
1024
1162
  if (type !== 'defined') {
1025
- t.state.pointIds = psids;
1026
- // t.setState({
1163
+ t.state.pointIds = psids; // t.setState({
1027
1164
  // pointIds: psids
1028
1165
  // });
1029
1166
  }
1030
- }
1031
- //更新点
1167
+ } //更新点
1168
+
1032
1169
  }, {
1033
1170
  key: "updatePoint",
1034
1171
  value: function updatePoint(mapPoints) {
1035
1172
  var _this4 = this;
1173
+
1036
1174
  var t = this;
1037
1175
  mapPoints.map(function (item, index) {
1038
1176
  //判断图元是否存在.
@@ -1041,10 +1179,13 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1041
1179
  if (!item.longitude || !item.latitude) {
1042
1180
  console.warn("\u70B9 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
1043
1181
  return false;
1044
- }
1045
- //获取原有的图元
1182
+ } //获取原有的图元
1183
+
1184
+
1046
1185
  var gc = _this4.GM.getGraphic(item.id);
1186
+
1047
1187
  var cg = null;
1188
+
1048
1189
  if (!!item.markerContent) {
1049
1190
  cg = {
1050
1191
  markerContentX: (item.config || {}).markerContentX || gc.getIcon().options.iconSize.x,
@@ -1052,17 +1193,20 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1052
1193
  //暂时不设置旋转角度,后期维护设置吧
1053
1194
  // deg: item.config.deg,
1054
1195
  zIndex: (item.config || {}).zIndex || gc.options.zIndexOffset
1055
- };
1056
- //设置点的标记添加顺序
1196
+ }; //设置点的标记添加顺序
1057
1197
  // gc.setZindex(cg.zIndex);
1198
+
1058
1199
  gc.setZIndexOffset(cg.zIndex);
1200
+
1059
1201
  if (!(item.config || {}).isAnimation) {
1060
1202
  //修改经纬度
1061
1203
  gc.setLngLat(new T.LngLat(item.longitude, item.latitude));
1062
1204
  }
1205
+
1063
1206
  if (gc.label) {
1064
1207
  _this4.state.gis.removeOverLay(gc.label);
1065
1208
  }
1209
+
1066
1210
  gc.label = new T.Label({
1067
1211
  text: item.markerContent,
1068
1212
  offset: new T.Point(cg.markerContentX - 12, cg.markerContentY + 15)
@@ -1088,46 +1232,54 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1088
1232
  iconSize: new T.Point(cg.width, cg.height),
1089
1233
  iconAnchor: new T.Point(-cg.markerContentX, -cg.markerContentY)
1090
1234
  }));
1235
+
1091
1236
  if (!(item.config || {}).isAnimation) {
1092
1237
  //修改经纬度
1093
1238
  gc.setLngLat(new T.LngLat(item.longitude, item.latitude));
1094
- }
1095
- //是否展示label
1239
+ } //是否展示label
1240
+
1241
+
1096
1242
  if (item.canShowLabel) {
1097
1243
  if (gc.label) {
1098
1244
  _this4.state.gis.removeOverLay(gc.label);
1099
- }
1100
- // cg.labelPixelX= (item.config || {}).labelPixelX?(item.config || {}).labelPixelX - (cg.width/2):gc.getLabel().options.offset.x;
1245
+ } // cg.labelPixelX= (item.config || {}).labelPixelX?(item.config || {}).labelPixelX - (cg.width/2):gc.getLabel().options.offset.x;
1101
1246
  // cg.labelPixelY= (item.config || {}).labelPixelY?(item.config || {}).labelPixelY + (cg.markerContentY + cg.height/2):gc.getLabel().options.offset.y;
1102
1247
  // cg.labelContent= (item.config || {}).labelContent || gc.getLabel().options.text;
1248
+
1249
+
1103
1250
  cg.labelPixelX = (item.config || {}).labelPixelX ? (item.config || {}).labelPixelX - cg.width / 2 : cg.labelPixelX - cg.width / 2;
1104
1251
  cg.labelPixelY = (item.config || {}).labelPixelY ? (item.config || {}).labelPixelY + (cg.markerContentY + cg.height / 2) : cg.labelPixelY + (cg.markerContentY + cg.height / 2);
1105
1252
  cg.labelContent = (item.config || {}).labelContent || '';
1106
- var labelClass = item.labelClass || 'label-content';
1107
- //更新label
1253
+ var labelClass = item.labelClass || 'label-content'; //更新label
1254
+
1108
1255
  gc.label = new T.Label({
1109
1256
  text: "<div class='".concat(labelClass, "'>").concat(cg.labelContent, "</div>"),
1110
1257
  offset: new T.Point(cg.labelPixelX, cg.labelPixelY)
1111
1258
  });
1112
1259
  gc.showLabel();
1113
- }
1114
- //设置点的标记添加顺序
1260
+ } //设置点的标记添加顺序
1261
+
1262
+
1115
1263
  gc.setZIndexOffset(cg.zIndex);
1116
- }
1117
- //点跳动动画
1264
+ } //点跳动动画
1265
+
1266
+
1118
1267
  if (!item.markerContent && cg.BAnimationType == 0) {
1119
1268
  t.pointAnimation(item.id, gc);
1120
1269
  } else {
1121
1270
  t.pointAnimation(item.id, null);
1122
1271
  }
1272
+
1123
1273
  if (cg.deg) {
1124
1274
  gc.getElement().style.transform = gc.getElement().style.transform + " rotate(".concat(cg.deg, "deg)");
1125
1275
  gc.getElement().style['-ms-transform'] = " rotate(".concat(cg.deg, "deg)");
1126
- }
1127
- //动画效果会延迟执行经纬度的切换
1276
+ } //动画效果会延迟执行经纬度的切换
1277
+
1278
+
1128
1279
  if ((item.config || {}).isAnimation) {
1129
1280
  t.moveTo(item.id, [item.longitude, item.latitude], (item.config || {}).animationDelay, (item.config || {}).autoRotation, item.url, item.urlleft);
1130
1281
  }
1282
+
1131
1283
  _this4.GM.setGraphicParam(item.id, {
1132
1284
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1133
1285
  other: item
@@ -1146,15 +1298,18 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1146
1298
  }
1147
1299
  });
1148
1300
  t.moveAnimation();
1149
- }
1150
- //添加线
1301
+ } //添加线
1302
+
1151
1303
  }, {
1152
1304
  key: "addLine",
1153
1305
  value: function addLine(mapLines, type) {
1154
1306
  var _this5 = this;
1307
+
1155
1308
  var t = this;
1156
- var lsids = _toConsumableArray(t.state.lineIds);
1157
- //遍历添加线(图元)
1309
+
1310
+ var lsids = _toConsumableArray(t.state.lineIds); //遍历添加线(图元)
1311
+
1312
+
1158
1313
  mapLines.map(function (item, index) {
1159
1314
  var cg = {
1160
1315
  color: '#277ffa',
@@ -1162,37 +1317,41 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1162
1317
  lineWidth: 5,
1163
1318
  lineType: 'solid',
1164
1319
  isHidden: false
1165
- };
1166
- //如果id重复,直接跳过不执行.
1320
+ }; //如果id重复,直接跳过不执行.
1321
+
1167
1322
  if (_this5.GM.isRepetition(item.id)) {
1168
1323
  console.warn("\u591A\u6298\u7EBFid: ".concat(item.id, " \u91CD\u590D"));
1169
1324
  return false;
1170
- }
1171
- //多折线点位数据不符合,直接跳过
1325
+ } //多折线点位数据不符合,直接跳过
1326
+
1327
+
1172
1328
  if (!(item.paths && item.paths.length >= 2)) {
1173
1329
  console.warn("\u591A\u6298\u7EBFpaths\u6570\u636E\u9519\u8BEF");
1174
1330
  return false;
1175
1331
  }
1332
+
1176
1333
  if (item.config) {
1177
1334
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1178
1335
  }
1336
+
1179
1337
  var lineOption = {
1180
1338
  color: cg.color,
1181
1339
  opacity: cg.pellucidity,
1182
1340
  weight: cg.lineWidth,
1183
1341
  lineStyle: cg.lineType,
1184
1342
  path: item.paths || []
1185
- };
1186
- //天地图没有hidden方法,所以用weight为0来实现
1343
+ }; //天地图没有hidden方法,所以用weight为0来实现
1344
+
1187
1345
  if (cg.isHidden) {
1188
1346
  lineOption.weight = 0;
1189
1347
  }
1348
+
1190
1349
  var p = lineOption.path.map(function (itm, ind) {
1191
1350
  return new T.LngLat(itm[0], itm[1]);
1192
1351
  });
1193
1352
  var polyline = new T.Polyline(p, lineOption);
1194
- t.state.gis.addOverLay(polyline);
1195
- // 添加点击事件
1353
+ t.state.gis.addOverLay(polyline); // 添加点击事件
1354
+
1196
1355
  polyline.addEventListener('click', function (e) {
1197
1356
  t.isNotClickMap = true;
1198
1357
  t.clickGraphic(item.id, e);
@@ -1202,11 +1361,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1202
1361
  });
1203
1362
  polyline.addEventListener('mouseout', function (e) {
1204
1363
  t.mouseOutGraphic(item.id, e);
1205
- });
1206
- //缓存图元的数据,便于后期操作
1364
+ }); //缓存图元的数据,便于后期操作
1365
+
1207
1366
  var pts = item.paths.map(function (itm, ind) {
1208
1367
  return _toConsumableArray(itm);
1209
1368
  });
1369
+
1210
1370
  _this5.GM.setGraphic(item.id, polyline).setGraphicParam(item.id, {
1211
1371
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1212
1372
  paths: [pts],
@@ -1218,24 +1378,26 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1218
1378
  paths: [pts]
1219
1379
  }
1220
1380
  });
1221
- lsids.push(item.id);
1222
- //state中缓存 line的id...用于数据判断
1381
+
1382
+ lsids.push(item.id); //state中缓存 line的id...用于数据判断
1383
+
1223
1384
  t.state.lineIds.push(item.id);
1224
1385
  });
1386
+
1225
1387
  if (type !== 'defined') {
1226
- t.state.lineIds = lsids;
1227
- // t.setState({
1388
+ t.state.lineIds = lsids; // t.setState({
1228
1389
  // lineIds: lsids
1229
1390
  // });
1230
1391
  }
1231
- }
1232
- //更新线
1392
+ } //更新线
1393
+
1233
1394
  }, {
1234
1395
  key: "updateLine",
1235
1396
  value: function updateLine(mapLines) {
1236
1397
  var _this6 = this;
1237
- var t = this;
1238
- //遍历添加线(图元)
1398
+
1399
+ var t = this; //遍历添加线(图元)
1400
+
1239
1401
  mapLines.map(function (item, index) {
1240
1402
  //判断图元是否存在.
1241
1403
  if (_this6.GM.isRepetition(item.id)) {
@@ -1243,38 +1405,44 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1243
1405
  if (!(item.paths && item.paths.length >= 2)) {
1244
1406
  console.warn("\u591A\u6298\u7EBFpaths\u6570\u636E\u9519\u8BEF");
1245
1407
  return false;
1246
- }
1247
- //获取原有的图元
1248
- var gc = _this6.GM.getGraphic(item.id);
1249
- //获取原有的线属性,转换key值
1408
+ } //获取原有的图元
1409
+
1410
+
1411
+ var gc = _this6.GM.getGraphic(item.id); //获取原有的线属性,转换key值
1412
+
1413
+
1250
1414
  var cg = {
1251
1415
  color: gc.getColor(),
1252
1416
  pellucidity: gc.getOpacity(),
1253
1417
  lineWidth: gc.getWeight(),
1254
1418
  lineType: gc.getLineStyle()
1255
- };
1256
- //重新初始化值
1419
+ }; //重新初始化值
1420
+
1257
1421
  if (item.config) {
1258
1422
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1259
- }
1260
- //更新线
1423
+ } //更新线
1424
+
1425
+
1261
1426
  gc.setColor(cg.color);
1262
1427
  gc.setOpacity(cg.pellucidity);
1263
- gc.setLineStyle(cg.lineType);
1264
- //根据参数判断是否显示多折线
1428
+ gc.setLineStyle(cg.lineType); //根据参数判断是否显示多折线
1429
+
1265
1430
  gc.setWeight(cg.lineWidth || 5);
1431
+
1266
1432
  if (item.config && item.config.isHidden) {
1267
1433
  gc.setWeight(0);
1268
- }
1269
- //更新经纬度
1434
+ } //更新经纬度
1435
+
1436
+
1270
1437
  var p = item.paths.map(function (itm, ind) {
1271
1438
  return new T.LngLat(itm[0], itm[1]);
1272
1439
  });
1273
- gc.setLngLats(p);
1274
- //处理数据 用于其他事件返回
1440
+ gc.setLngLats(p); //处理数据 用于其他事件返回
1441
+
1275
1442
  var pts = item.paths.map(function (itm, ind) {
1276
1443
  return _toConsumableArray(itm);
1277
1444
  });
1445
+
1278
1446
  _this6.GM.setGraphicParam(item.id, {
1279
1447
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1280
1448
  paths: [pts],
@@ -1291,15 +1459,18 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1291
1459
  return false;
1292
1460
  }
1293
1461
  });
1294
- }
1295
- //添加面
1462
+ } //添加面
1463
+
1296
1464
  }, {
1297
1465
  key: "addPolygon",
1298
1466
  value: function addPolygon(mapPolygons) {
1299
1467
  var _this7 = this;
1468
+
1300
1469
  var t = this;
1301
- var pgsids = _toConsumableArray(t.state.polygonIds);
1302
- //遍历添加面(图元)
1470
+
1471
+ var pgsids = _toConsumableArray(t.state.polygonIds); //遍历添加面(图元)
1472
+
1473
+
1303
1474
  mapPolygons.map(function (item, index) {
1304
1475
  var cg = {
1305
1476
  lineType: 'solid',
@@ -1307,22 +1478,25 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1307
1478
  lineColor: '#277ffa',
1308
1479
  lineOpacity: 1,
1309
1480
  color: '#fff',
1310
- pellucidity: 0.5
1311
- // isHidden: false //后期跟百度一起加
1312
- };
1313
- //如果id重复,直接跳过不执行.
1481
+ pellucidity: 0.5 // isHidden: false //后期跟百度一起加
1482
+
1483
+ }; //如果id重复,直接跳过不执行.
1484
+
1314
1485
  if (_this7.GM.isRepetition(item.id)) {
1315
1486
  console.warn("\u591A\u8FB9\u5F62id: ".concat(item.id, " \u91CD\u590D"));
1316
1487
  return false;
1317
- }
1318
- //多边形点位数据不符合,直接跳过
1488
+ } //多边形点位数据不符合,直接跳过
1489
+
1490
+
1319
1491
  if (!(item.rings && item.rings.length >= 3)) {
1320
1492
  console.warn("\u591A\u8FB9\u5F62rings\u6570\u636E\u9519\u8BEF");
1321
1493
  return false;
1322
1494
  }
1495
+
1323
1496
  if (item.config) {
1324
1497
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1325
1498
  }
1499
+
1326
1500
  var polygonOption = {
1327
1501
  color: cg.lineColor,
1328
1502
  opacity: cg.lineOpacity,
@@ -1336,8 +1510,10 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1336
1510
  return new T.LngLat(itm[0], itm[1]);
1337
1511
  });
1338
1512
  var polygon = new T.Polygon(r, polygonOption);
1339
- _this7.state.gis.addOverLay(polygon);
1340
- //添加点击事件
1513
+
1514
+ _this7.state.gis.addOverLay(polygon); //添加点击事件
1515
+
1516
+
1341
1517
  polygon.on('click', function (e) {
1342
1518
  t.isNotClickMap = true;
1343
1519
  t.clickGraphic(item.id, e);
@@ -1347,11 +1523,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1347
1523
  });
1348
1524
  polygon.on('mouseout', function (e) {
1349
1525
  t.mouseOutGraphic(item.id, e);
1350
- });
1351
- //缓存图元的数据,便于后期操作
1526
+ }); //缓存图元的数据,便于后期操作
1527
+
1352
1528
  var pts = item.rings.map(function (itm, ind) {
1353
1529
  return _toConsumableArray(itm);
1354
1530
  });
1531
+
1355
1532
  _this7.GM.setGraphic(item.id, polygon).setGraphicParam(item.id, {
1356
1533
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1357
1534
  rings: [pts],
@@ -1363,18 +1540,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1363
1540
  rings: [pts]
1364
1541
  }
1365
1542
  });
1543
+
1366
1544
  pgsids.push(item.id);
1367
1545
  });
1368
- t.state.polygonIds = pgsids;
1369
- // t.setState({
1546
+ t.state.polygonIds = pgsids; // t.setState({
1370
1547
  // polygonIds: pgsids
1371
1548
  // })
1372
- }
1373
- //更新面
1549
+ } //更新面
1550
+
1374
1551
  }, {
1375
1552
  key: "updatePolygon",
1376
1553
  value: function updatePolygon(mapPolygons) {
1377
1554
  var _this8 = this;
1555
+
1378
1556
  var t = this;
1379
1557
  mapPolygons.map(function (item, index) {
1380
1558
  //判断图元是否存在.
@@ -1383,10 +1561,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1383
1561
  if (!(item.rings && item.rings.length >= 3)) {
1384
1562
  console.warn("\u591A\u8FB9\u5F62rings\u6570\u636E\u9519\u8BEF");
1385
1563
  return false;
1386
- }
1387
- //获取原有的图元
1388
- var gc = _this8.GM.getGraphic(item.id);
1389
- //获取原有的面属性,转换key值
1564
+ } //获取原有的图元
1565
+
1566
+
1567
+ var gc = _this8.GM.getGraphic(item.id); //获取原有的面属性,转换key值
1568
+
1569
+
1390
1570
  var cg = {
1391
1571
  lineType: gc.getLineStyle(),
1392
1572
  lineWidth: gc.getWeight(),
@@ -1394,11 +1574,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1394
1574
  lineOpacity: gc.getOpacity(),
1395
1575
  color: gc.getFillColor(),
1396
1576
  pellucidity: gc.getFillOpacity()
1397
- };
1398
- //重新初始化值
1577
+ }; //重新初始化值
1578
+
1399
1579
  if (item.config) {
1400
1580
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1401
1581
  }
1582
+
1402
1583
  gc.setLineStyle(cg.lineType);
1403
1584
  gc.setWeight(cg.lineWidth);
1404
1585
  gc.setColor(cg.lineColor);
@@ -1412,6 +1593,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1412
1593
  var pts = item.rings.map(function (itm, ind) {
1413
1594
  return _toConsumableArray(itm);
1414
1595
  });
1596
+
1415
1597
  _this8.GM.setGraphicParam(item.id, {
1416
1598
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1417
1599
  rings: [pts],
@@ -1428,14 +1610,17 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1428
1610
  return false;
1429
1611
  }
1430
1612
  });
1431
- }
1432
- //添加圆 circle
1613
+ } //添加圆 circle
1614
+
1433
1615
  }, {
1434
1616
  key: "addCircle",
1435
1617
  value: function addCircle(mapCircles) {
1436
1618
  var _this9 = this;
1619
+
1437
1620
  var t = this;
1621
+
1438
1622
  var ccsids = _toConsumableArray(t.state.circleIds);
1623
+
1439
1624
  mapCircles.map(function (item, index) {
1440
1625
  var cg = {
1441
1626
  lineType: 'solid',
@@ -1443,23 +1628,26 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1443
1628
  lineColor: '#277ffa',
1444
1629
  lineOpacity: 1,
1445
1630
  color: '#fff',
1446
- pellucidity: 0.5
1447
- // isHidden: false //后期跟百度一起加
1448
- };
1449
- //如果id重复,直接跳过不执行.
1631
+ pellucidity: 0.5 // isHidden: false //后期跟百度一起加
1632
+
1633
+ }; //如果id重复,直接跳过不执行.
1634
+
1450
1635
  if (_this9.GM.isRepetition(item.id)) {
1451
1636
  console.warn("\u5706id: ".concat(item.id, " \u91CD\u590D"));
1452
1637
  return false;
1453
- }
1454
- //圆 点位数据不符合,直接跳过
1638
+ } //圆 点位数据不符合,直接跳过
1639
+
1640
+
1455
1641
  if (!item.longitude || !item.latitude) {
1456
1642
  console.warn("\u5706 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
1457
1643
  return false;
1458
1644
  }
1645
+
1459
1646
  if (item.config) {
1460
1647
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1461
- }
1462
- //初始化配置数据
1648
+ } //初始化配置数据
1649
+
1650
+
1463
1651
  var circleOption = {
1464
1652
  color: cg.lineColor,
1465
1653
  opacity: cg.lineOpacity,
@@ -1467,11 +1655,13 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1467
1655
  lineStyle: cg.lineType,
1468
1656
  fillColor: cg.color,
1469
1657
  fillOpacity: cg.pellucidity
1470
- };
1471
- //创建圆对象
1658
+ }; //创建圆对象
1659
+
1472
1660
  var circle = new T.Circle(new T.LngLat(item.longitude, item.latitude), item.radius, circleOption);
1473
- _this9.state.gis.addOverLay(circle);
1474
- //添加点击事件
1661
+
1662
+ _this9.state.gis.addOverLay(circle); //添加点击事件
1663
+
1664
+
1475
1665
  circle.on('click', function (e) {
1476
1666
  t.isNotClickMap = true;
1477
1667
  t.clickGraphic(item.id, e);
@@ -1481,8 +1671,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1481
1671
  });
1482
1672
  circle.on('mouseout', function (e) {
1483
1673
  t.mouseOutGraphic(item.id, e);
1484
- });
1485
- //缓存图元的数据,便于后期操作
1674
+ }); //缓存图元的数据,便于后期操作
1675
+
1486
1676
  _this9.GM.setGraphic(item.id, circle).setGraphicParam(item.id, {
1487
1677
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1488
1678
  other: item
@@ -1495,18 +1685,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1495
1685
  radius: item.radius
1496
1686
  }
1497
1687
  });
1688
+
1498
1689
  ccsids.push(item.id);
1499
1690
  });
1500
- t.state.circleIds = ccsids;
1501
- // t.setState({
1691
+ t.state.circleIds = ccsids; // t.setState({
1502
1692
  // circleIds: ccsids
1503
1693
  // })
1504
- }
1505
- //更新圆
1694
+ } //更新圆
1695
+
1506
1696
  }, {
1507
1697
  key: "updateCircle",
1508
1698
  value: function updateCircle(mapCircles) {
1509
1699
  var _this10 = this;
1700
+
1510
1701
  var t = this;
1511
1702
  mapCircles.map(function (item, index) {
1512
1703
  //判断图元是否存在.
@@ -1515,10 +1706,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1515
1706
  if (!item.longitude || !item.latitude) {
1516
1707
  console.warn("\u5706 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
1517
1708
  return false;
1518
- }
1519
- //获取原有的图元
1520
- var gc = _this10.GM.getGraphic(item.id);
1521
- //获取原有的面属性,转换key值
1709
+ } //获取原有的图元
1710
+
1711
+
1712
+ var gc = _this10.GM.getGraphic(item.id); //获取原有的面属性,转换key值
1713
+
1714
+
1522
1715
  var cg = {
1523
1716
  lineType: gc.getLineStyle(),
1524
1717
  lineWidth: gc.getWeight(),
@@ -1526,11 +1719,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1526
1719
  lineOpacity: gc.getOpacity(),
1527
1720
  color: gc.getFillColor(),
1528
1721
  pellucidity: gc.getFillOpacity()
1529
- };
1530
- //重新初始化值
1722
+ }; //重新初始化值
1723
+
1531
1724
  if (item.config) {
1532
1725
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1533
1726
  }
1727
+
1534
1728
  gc.setLineStyle(cg.lineType);
1535
1729
  gc.setWeight(cg.lineWidth);
1536
1730
  gc.setColor(cg.lineColor);
@@ -1538,9 +1732,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1538
1732
  gc.setFillColor(cg.color);
1539
1733
  gc.setFillOpacity(cg.pellucidity);
1540
1734
  gc.setRadius(item.radius || 0);
1541
- gc.setCenter(new T.LngLat(item.longitude, item.latitude));
1735
+ gc.setCenter(new T.LngLat(item.longitude, item.latitude)); //缓存图元的数据,便于后期操作
1542
1736
 
1543
- //缓存图元的数据,便于后期操作
1544
1737
  _this10.GM.setGraphicParam(item.id, {
1545
1738
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1546
1739
  other: item
@@ -1558,8 +1751,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1558
1751
  return false;
1559
1752
  }
1560
1753
  });
1561
- }
1562
- //添加海量点
1754
+ } //添加海量点
1755
+
1563
1756
  }, {
1564
1757
  key: "addPointCollection",
1565
1758
  value: function addPointCollection() {
@@ -1579,8 +1772,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1579
1772
  width: t.state.gis.getSize().x,
1580
1773
  height: t.state.gis.getSize().y,
1581
1774
  mapId: t.props.mapId
1582
- };
1583
- //和arcgis使用同一个海量点
1775
+ }; //和arcgis使用同一个海量点
1776
+
1584
1777
  var VotexpointCollection = new GMapLib.PointCollection(points, options);
1585
1778
  t.morepoints.push({
1586
1779
  id: d.id,
@@ -1588,8 +1781,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1588
1781
  });
1589
1782
  VotexpointCollection.draw();
1590
1783
  });
1591
- }
1592
- //更新海量点
1784
+ } //更新海量点
1785
+
1593
1786
  }, {
1594
1787
  key: "updatePointCollection",
1595
1788
  value: function updatePointCollection() {
@@ -1614,8 +1807,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1614
1807
  }
1615
1808
  });
1616
1809
  });
1617
- }
1618
- //清空单个海量点
1810
+ } //清空单个海量点
1811
+
1619
1812
  }, {
1620
1813
  key: "clearPointCollection",
1621
1814
  value: function clearPointCollection(ids) {
@@ -1627,8 +1820,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1627
1820
  }
1628
1821
  });
1629
1822
  });
1630
- }
1631
- //清空海量点
1823
+ } //清空海量点
1824
+
1632
1825
  }, {
1633
1826
  key: "clearAllPointCollection",
1634
1827
  value: function clearAllPointCollection() {
@@ -1636,8 +1829,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1636
1829
  t.morepoints.map(function (item, index) {
1637
1830
  item.value.clear();
1638
1831
  });
1639
- }
1640
- //热力图
1832
+ } //热力图
1833
+
1641
1834
  }, {
1642
1835
  key: "heatMapOverlay",
1643
1836
  value: function heatMapOverlay() {
@@ -1649,29 +1842,35 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1649
1842
  visible: true,
1650
1843
  opacity: 0.7
1651
1844
  };
1845
+
1652
1846
  if (d.config) {
1653
1847
  cg = _objectSpread(_objectSpread({}, cg), d.config);
1654
1848
  }
1849
+
1655
1850
  if (!t.heatmap) {
1656
1851
  t.heatmap = new TMapLib.HeatmapOverlay({
1657
1852
  visible: cg.visible
1658
1853
  });
1659
1854
  t.heatmap.initialize(t.state.gis, t.pointCollectionId);
1660
1855
  }
1856
+
1661
1857
  var option = {
1662
1858
  radius: cg.radius,
1663
1859
  //百度是1-100,高德是0-1
1664
1860
  opacity: eval(cg.opacity) * 100,
1665
1861
  visible: cg.visible
1666
1862
  };
1863
+
1667
1864
  if (cg.gradient) {
1668
1865
  option.gradient = cg.gradient;
1669
1866
  }
1867
+
1670
1868
  t.heatmap.setOptions(option);
1671
1869
  t.heatmap.setDataSet({
1672
1870
  max: cg.max,
1673
1871
  data: d.data || []
1674
1872
  });
1873
+
1675
1874
  if (cg.visible) {
1676
1875
  t.isHideHeatMap = false;
1677
1876
  t.heatmap.show();
@@ -1679,8 +1878,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1679
1878
  t.isHideHeatMap = true;
1680
1879
  t.heatmap.hide();
1681
1880
  }
1682
- }
1683
- //信息窗体
1881
+ } //信息窗体
1882
+
1684
1883
  }, {
1685
1884
  key: "infoWindow",
1686
1885
  value: function infoWindow() {
@@ -1690,18 +1889,22 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1690
1889
  width: 300,
1691
1890
  height: 172
1692
1891
  };
1892
+
1693
1893
  if (d.config) {
1694
1894
  cg = _objectSpread(_objectSpread({}, cg), d.config);
1695
1895
  }
1896
+
1696
1897
  var sContent = document.createElement('div');
1697
1898
  var infowindow = new T.InfoWindow();
1698
1899
  infowindow.setMinWidth(cg.width);
1699
1900
  infowindow.setMaxHeight(cg.height);
1901
+
1700
1902
  if (d.onClose instanceof Function) {
1701
1903
  infowindow.addEventListener("clickclose", function (e) {
1702
1904
  d.onClose(e);
1703
1905
  });
1704
1906
  }
1907
+
1705
1908
  if (d.lat && d.lng && d.content) {
1706
1909
  (0, _reactDom.render)(d.content, sContent);
1707
1910
  infowindow.setContent(sContent);
@@ -1716,42 +1919,51 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1716
1919
  parameter 样式 默认null 对象{}写入方式跟add方法一样(对应点线圆面)
1717
1920
  data //初始化数据 默认{id:'add'}
1718
1921
  */
1922
+
1719
1923
  }, {
1720
1924
  key: "draw",
1721
1925
  value: function draw(obj) {
1722
1926
  var t = this,
1723
- drawParam = {};
1724
- //初始化参数
1927
+ drawParam = {}; //初始化参数
1928
+
1725
1929
  drawParam.geometryType = obj.geometryType || 'point';
1726
1930
  drawParam.parameter = obj.parameter ? _objectSpread({}, obj.parameter) : {};
1727
1931
  drawParam.data = obj.data ? _objectSpread({}, obj.data) : {};
1728
- drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime());
1729
- //判断id是否存在
1932
+ drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime()); //判断id是否存在
1933
+
1730
1934
  var len = t.state.drawIds[drawParam.geometryType].indexOf(drawParam.data.id);
1935
+
1731
1936
  if (len > -1) {
1732
1937
  //如果id存在 删除存在的图元,清除drawId中的id数据
1733
1938
  switch (drawParam.geometryType) {
1734
1939
  case 'point':
1735
1940
  this.markerTool.clear();
1736
1941
  break;
1942
+
1737
1943
  case 'polyline':
1738
1944
  this.polylineTool.clear();
1739
1945
  break;
1946
+
1740
1947
  case 'polygon':
1741
1948
  this.polygonTool.clear();
1742
1949
  break;
1950
+
1743
1951
  case 'circle':
1744
1952
  this.circleTool.clear();
1745
1953
  break;
1954
+
1746
1955
  case 'rectangle':
1747
1956
  this.rectangleTool.clear();
1748
1957
  break;
1749
1958
  }
1959
+
1750
1960
  t.state.drawIds[drawParam.geometryType].splice(len, 1);
1751
1961
  }
1962
+
1752
1963
  var param = {};
1753
1964
  var paramgcr = {};
1754
1965
  window.map = this.state.gis;
1966
+
1755
1967
  if (drawParam.geometryType == 'polygon' || drawParam.geometryType == 'circle' || drawParam.geometryType == 'rectangle') {
1756
1968
  paramgcr.fillColor = drawParam.parameter.color;
1757
1969
  paramgcr.color = drawParam.parameter.lineColor;
@@ -1773,6 +1985,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1773
1985
  type: drawParam.geometryType
1774
1986
  };
1775
1987
  }
1988
+
1776
1989
  switch (drawParam.geometryType) {
1777
1990
  case 'point':
1778
1991
  param.icon = new T.Icon({
@@ -1786,10 +1999,10 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1786
1999
  this.markerTool.open();
1787
2000
  this.markerTool.addEventListener('mouseup', function (ob) {
1788
2001
  var type = ob.type,
1789
- target = ob.target,
1790
- currentLnglat = ob.currentLnglat,
1791
- currentMarker = ob.currentMarker,
1792
- allMarkers = ob.allMarkers;
2002
+ target = ob.target,
2003
+ currentLnglat = ob.currentLnglat,
2004
+ currentMarker = ob.currentMarker,
2005
+ allMarkers = ob.allMarkers;
1793
2006
  t.GM.setGraphic(drawParam.data.id, currentMarker);
1794
2007
  var backobj = {
1795
2008
  id: drawParam.data.id,
@@ -1808,8 +2021,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1808
2021
  },
1809
2022
  geometryType: 'point',
1810
2023
  mapLayer: currentMarker
1811
- };
1812
- //添加点击事件
2024
+ }; //添加点击事件
2025
+
1813
2026
  currentMarker.on('click', function (e) {
1814
2027
  t.isNotClickMap = true;
1815
2028
  t.clickGraphic(drawParam.data.id, e);
@@ -1821,11 +2034,13 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1821
2034
  t.mouseOutGraphic(drawParam.data.id, e);
1822
2035
  });
1823
2036
  t.GM.setGraphicParam(drawParam.data.id, backobj);
2037
+
1824
2038
  if ('drawEnd' in t.props) {
1825
2039
  t.props.drawEnd(backobj);
1826
2040
  }
1827
2041
  });
1828
2042
  break;
2043
+
1829
2044
  case 'polyline':
1830
2045
  param.color = drawParam.parameter.color;
1831
2046
  param.opacity = drawParam.parameter.pellucidity;
@@ -1835,11 +2050,11 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1835
2050
  this.polylineTool.open();
1836
2051
  this.polylineTool.addEventListener('draw', function (ob) {
1837
2052
  var type = ob.type,
1838
- target = ob.target,
1839
- currentLnglats = ob.currentLnglats,
1840
- currentDistance = ob.currentDistance,
1841
- currentPolyline = ob.currentPolyline,
1842
- allPolylines = ob.allPolylines;
2053
+ target = ob.target,
2054
+ currentLnglats = ob.currentLnglats,
2055
+ currentDistance = ob.currentDistance,
2056
+ currentPolyline = ob.currentPolyline,
2057
+ allPolylines = ob.allPolylines;
1843
2058
  var lnglatAry = (currentLnglats || []).map(function (item, index) {
1844
2059
  return {
1845
2060
  lngX: item.lng,
@@ -1866,8 +2081,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1866
2081
  paths: (0, _MapToolFunction.getMaxMin)(currentLnglats).path
1867
2082
  },
1868
2083
  lnglatAry: lnglatAry
1869
- };
1870
- //添加点击事件
2084
+ }; //添加点击事件
2085
+
1871
2086
  currentPolyline.on('click', function (e) {
1872
2087
  t.isNotClickMap = true;
1873
2088
  t.clickGraphic(drawParam.data.id, e);
@@ -1879,23 +2094,26 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1879
2094
  t.mouseOutGraphic(drawParam.data.id, e);
1880
2095
  });
1881
2096
  t.GM.setGraphicParam(drawParam.data.id, backobj);
2097
+
1882
2098
  if ('drawEnd' in t.props) {
1883
2099
  t.props.drawEnd(backobj);
1884
2100
  }
1885
2101
  });
1886
2102
  break;
2103
+
1887
2104
  case 'polygon':
1888
2105
  if (this.polygonTool) this.polygonTool.close();
1889
2106
  this.polygonTool = new T.PolygonTool(this.state.gis, paramgcr);
1890
2107
  this.polygonTool.open();
1891
2108
  this.polygonTool.addEventListener('draw', function (ob) {
1892
2109
  var _t$frameSelectProps$b;
2110
+
1893
2111
  var type = ob.type,
1894
- target = ob.target,
1895
- currentLnglats = ob.currentLnglats,
1896
- currentArea = ob.currentArea,
1897
- currentPolygon = ob.currentPolygon,
1898
- allPolygons = ob.allPolygons;
2112
+ target = ob.target,
2113
+ currentLnglats = ob.currentLnglats,
2114
+ currentArea = ob.currentArea,
2115
+ currentPolygon = ob.currentPolygon,
2116
+ allPolygons = ob.allPolygons;
1899
2117
  t.GM.setGraphic(drawParam.data.id, currentPolygon);
1900
2118
  var lnglatAry = (currentLnglats || []).map(function (item, index) {
1901
2119
  return {
@@ -1926,8 +2144,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1926
2144
  },
1927
2145
  lnglatAry: lnglatAry,
1928
2146
  area: currentArea
1929
- };
1930
- //添加点击事件
2147
+ }; //添加点击事件
2148
+
1931
2149
  currentPolygon.on('click', function (e) {
1932
2150
  t.isNotClickMap = true;
1933
2151
  t.clickGraphic(drawParam.data.id, e);
@@ -1939,26 +2157,30 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1939
2157
  t.mouseOutGraphic(drawParam.data.id, e);
1940
2158
  });
1941
2159
  t.GM.setGraphicParam(drawParam.data.id, backobj);
2160
+
1942
2161
  if ('drawEnd' in t.props) {
1943
2162
  t.props.drawEnd(backobj);
1944
2163
  }
2164
+
1945
2165
  if (((_t$frameSelectProps$b = t.frameSelectProps[backobj.id]) === null || _t$frameSelectProps$b === void 0 ? void 0 : _t$frameSelectProps$b.callback) instanceof Function) {
1946
2166
  t.frameSelectProps[backobj.id].callback(backobj);
1947
2167
  }
1948
2168
  });
1949
2169
  break;
2170
+
1950
2171
  case 'circle':
1951
2172
  if (this.circleTool) this.circleTool.close();
1952
2173
  this.circleTool = new T.CircleTool(this.state.gis, paramgcr);
1953
2174
  this.circleTool.open();
1954
2175
  this.circleTool.addEventListener('drawend', function (ob) {
1955
2176
  var _t$frameSelectProps$b2;
2177
+
1956
2178
  var type = ob.type,
1957
- target = ob.target,
1958
- currentCenter = ob.currentCenter,
1959
- currentRadius = ob.currentRadius,
1960
- currentCircle = ob.currentCircle,
1961
- allCircles = ob.allCircles;
2179
+ target = ob.target,
2180
+ currentCenter = ob.currentCenter,
2181
+ currentRadius = ob.currentRadius,
2182
+ currentCircle = ob.currentCircle,
2183
+ allCircles = ob.allCircles;
1962
2184
  t.GM.setGraphic(drawParam.data.id, currentCircle);
1963
2185
  var area = Math.PI * Math.pow(currentRadius, 2);
1964
2186
  var backobj = {
@@ -1983,8 +2205,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1983
2205
  area: area
1984
2206
  },
1985
2207
  area: area
1986
- };
1987
- //添加点击事件
2208
+ }; //添加点击事件
2209
+
1988
2210
  currentCircle.on('click', function (e) {
1989
2211
  t.isNotClickMap = true;
1990
2212
  t.clickGraphic(drawParam.data.id, e);
@@ -1996,25 +2218,29 @@ var TMap = /*#__PURE__*/function (_React$Component) {
1996
2218
  t.mouseOutGraphic(drawParam.data.id, e);
1997
2219
  });
1998
2220
  t.GM.setGraphicParam(drawParam.data.id, backobj);
2221
+
1999
2222
  if ('drawEnd' in t.props) {
2000
2223
  t.props.drawEnd(backobj);
2001
2224
  }
2225
+
2002
2226
  if (((_t$frameSelectProps$b2 = t.frameSelectProps[backobj.id]) === null || _t$frameSelectProps$b2 === void 0 ? void 0 : _t$frameSelectProps$b2.callback) instanceof Function) {
2003
2227
  t.frameSelectProps[backobj.id].callback(backobj);
2004
2228
  }
2005
2229
  });
2006
2230
  break;
2231
+
2007
2232
  case 'rectangle':
2008
2233
  if (this.rectangleTool) this.rectangleTool.close();
2009
2234
  this.rectangleTool = new T.RectangleTool(this.state.gis, paramgcr);
2010
2235
  this.rectangleTool.open();
2011
2236
  this.rectangleTool.addEventListener('draw', function (ob) {
2012
2237
  var _t$frameSelectProps$b3;
2238
+
2013
2239
  var type = ob.type,
2014
- target = ob.target,
2015
- currentBounds = ob.currentBounds,
2016
- currentRectangle = ob.currentRectangle,
2017
- allRectangles = ob.allRectangles;
2240
+ target = ob.target,
2241
+ currentBounds = ob.currentBounds,
2242
+ currentRectangle = ob.currentRectangle,
2243
+ allRectangles = ob.allRectangles;
2018
2244
  t.GM.setGraphic(drawParam.data.id, currentRectangle);
2019
2245
  var currentLnglats = [currentBounds.getNorthEast(), currentBounds.getSouthWest(), {
2020
2246
  lng: currentBounds.getSouthWest().lng,
@@ -2053,8 +2279,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2053
2279
  },
2054
2280
  lnglatAry: lnglatAry,
2055
2281
  area: area
2056
- };
2057
- //添加点击事件
2282
+ }; //添加点击事件
2283
+
2058
2284
  currentRectangle.on('click', function (e) {
2059
2285
  t.isNotClickMap = true;
2060
2286
  t.clickGraphic(drawParam.data.id, e);
@@ -2066,63 +2292,77 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2066
2292
  t.mouseOutGraphic(drawParam.data.id, e);
2067
2293
  });
2068
2294
  t.GM.setGraphicParam(drawParam.data.id, backobj);
2295
+
2069
2296
  if ('drawEnd' in t.props) {
2070
2297
  t.props.drawEnd(backobj);
2071
2298
  }
2299
+
2072
2300
  if (((_t$frameSelectProps$b3 = t.frameSelectProps[backobj.id]) === null || _t$frameSelectProps$b3 === void 0 ? void 0 : _t$frameSelectProps$b3.callback) instanceof Function) {
2073
2301
  t.frameSelectProps[backobj.id].callback(backobj);
2074
2302
  }
2075
2303
  });
2076
2304
  break;
2077
- }
2078
- //保存绘制图元的id便于后期比对
2305
+ } //保存绘制图元的id便于后期比对
2306
+
2307
+
2079
2308
  t.state.drawIds[drawParam.geometryType].push(drawParam.data.id);
2080
- }
2081
- //关闭绘制图元
2309
+ } //关闭绘制图元
2310
+
2082
2311
  }, {
2083
2312
  key: "closeDraw",
2084
2313
  value: function closeDraw() {
2085
2314
  if (this.markerTool) {
2086
2315
  this.markerTool.close();
2087
2316
  }
2317
+
2088
2318
  if (this.polylineTool) {
2089
2319
  this.polylineTool.close();
2090
2320
  }
2321
+
2091
2322
  if (this.polygonTool) {
2092
2323
  this.polygonTool.close();
2093
2324
  }
2325
+
2094
2326
  if (this.rectangleTool) {
2095
2327
  this.rectangleTool.close();
2096
2328
  }
2329
+
2097
2330
  if (this.circleTool) {
2098
2331
  this.circleTool.close();
2099
2332
  }
2100
2333
  }
2101
-
2102
2334
  /*根据图元id,使图元变成可编辑状态*/
2335
+
2103
2336
  }, {
2104
2337
  key: "doEdit",
2105
2338
  value: function doEdit(id) {
2106
2339
  var t = this;
2107
2340
  var ms = t.getGraphic(id);
2341
+
2108
2342
  if (!ms) {
2109
2343
  return false;
2110
2344
  }
2345
+
2111
2346
  if (ms.getType === 1) {
2112
2347
  return false;
2113
2348
  }
2349
+
2114
2350
  if (!!t.state.editId) {
2115
2351
  t.endEdit();
2116
2352
  }
2353
+
2117
2354
  this.isEditId = id;
2355
+
2118
2356
  switch (ms.geometryType) {
2119
2357
  case 'point':
2120
- ms.mapLayer.enableDragging();
2121
- // ms.mapLayer.addEventListener('dragend',t.editGraphicChange);
2358
+ ms.mapLayer.enableDragging(); // ms.mapLayer.addEventListener('dragend',t.editGraphicChange);
2359
+
2122
2360
  if (ms.mapLayer.label) {
2123
2361
  ms.mapLayer.addEventListener('drag', t.showLabel);
2124
2362
  }
2363
+
2125
2364
  break;
2365
+
2126
2366
  case 'polyline':
2127
2367
  case 'polygon':
2128
2368
  case 'rectangle':
@@ -2130,25 +2370,29 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2130
2370
  ms.mapLayer.enableEdit();
2131
2371
  break;
2132
2372
  }
2373
+
2133
2374
  t.setState({
2134
2375
  editId: id
2135
2376
  });
2136
- }
2137
- //关闭编辑
2377
+ } //关闭编辑
2378
+
2138
2379
  }, {
2139
2380
  key: "endEdit",
2140
2381
  value: function endEdit() {
2141
2382
  var t = this;
2142
2383
  var ms = t.getGraphic(t.state.editId);
2143
2384
  this.isEditId = null;
2385
+
2144
2386
  switch (ms.geometryType) {
2145
2387
  case 'point':
2146
- ms.mapLayer.disableDragging();
2147
- // ms.mapLayer.removeEventListener('dragend',t.editGraphicChange);
2388
+ ms.mapLayer.disableDragging(); // ms.mapLayer.removeEventListener('dragend',t.editGraphicChange);
2389
+
2148
2390
  if (ms.mapLayer.label) {
2149
2391
  ms.mapLayer.removeEventListener('drag', t.showLabel);
2150
2392
  }
2393
+
2151
2394
  break;
2395
+
2152
2396
  case 'polyline':
2153
2397
  case 'polygon':
2154
2398
  case 'rectangle':
@@ -2156,6 +2400,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2156
2400
  ms.mapLayer.disableEdit();
2157
2401
  break;
2158
2402
  }
2403
+
2159
2404
  t.editGraphicChange(t.state.editId);
2160
2405
  t.setState({
2161
2406
  editId: '',
@@ -2167,8 +2412,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2167
2412
  value: function showLabel() {
2168
2413
  //这里的this指向调用的 点的对象
2169
2414
  this.showLabel();
2170
- }
2171
- //编辑变动后
2415
+ } //编辑变动后
2416
+
2172
2417
  }, {
2173
2418
  key: "editGraphicChange",
2174
2419
  value: function editGraphicChange(id) {
@@ -2178,121 +2423,149 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2178
2423
  var obj = {
2179
2424
  id: id
2180
2425
  };
2426
+
2181
2427
  switch (ms.geometryType) {
2182
2428
  case 'point':
2183
2429
  obj.geometry = ms.geometry;
2184
2430
  obj.param = ms;
2185
2431
  break;
2432
+
2186
2433
  case 'polyline':
2187
2434
  ms.geometry._extent = (0, _MapToolFunction.getMaxMin)(ms.mapLayer.getLngLats())._extent;
2188
2435
  obj.geometry = ms.geometry;
2189
2436
  obj.param = ms;
2190
2437
  obj.distance = t.calculateDistance(ms.mapLayer.getLngLats());
2191
2438
  break;
2439
+
2192
2440
  case 'polygon':
2193
2441
  case 'rectangle':
2194
2442
  ms.geometry._extent = (0, _MapToolFunction.getMaxMin)(ms.mapLayer.getLngLats()[0])._extent;
2195
2443
  obj.geometry = ms.geometry;
2196
- obj.param = ms;
2197
- // obj.area = getPolygonArea(ms.mapLayer.getLngLats()[0]);
2444
+ obj.param = ms; // obj.area = getPolygonArea(ms.mapLayer.getLngLats()[0]);
2198
2445
  // obj.area = t.polygonTool.getArea(ms.mapLayer.getLngLats()[0]);
2199
2446
  // 关闭多边形多个听绘制后,回显报错
2447
+
2200
2448
  break;
2449
+
2201
2450
  case 'circle':
2202
2451
  obj.geometry = ms.geometry;
2203
2452
  obj.param = ms;
2204
2453
  obj.area = Math.PI * Math.pow(ms.geometry.radius, 2);
2205
2454
  break;
2206
2455
  }
2456
+
2207
2457
  t.props.editGraphicChange(obj);
2208
- }
2209
- //删除图元
2458
+ } //删除图元
2459
+
2210
2460
  }, {
2211
2461
  key: "removeGraphic",
2212
2462
  value: function removeGraphic(id, type) {
2213
2463
  var t = this;
2464
+
2214
2465
  if (!!this.GM.getGraphic(id)) {
2215
2466
  //清除聚合点 避免异常
2216
2467
  if (t.clusterObj) {
2217
2468
  t.clusterObj.removeMarker(this.GM.getGraphic(id));
2218
- }
2219
- //清除地图中图元
2220
- this.state.gis.removeOverLay(this.GM.getGraphic(id));
2221
- //删除含 label点的label(天地图的坑)
2469
+ } //清除地图中图元
2470
+
2471
+
2472
+ this.state.gis.removeOverLay(this.GM.getGraphic(id)); //删除含 label点的label(天地图的坑)
2473
+
2222
2474
  if (type === 'point' && this.GM.getGraphic(id).label) {
2223
2475
  this.state.gis.removeOverLay(this.GM.getGraphic(id).getLabel());
2224
- }
2225
- //清除对应id的图元数据缓存
2476
+ } //清除对应id的图元数据缓存
2477
+
2478
+
2226
2479
  this.GM.removeGraphic(id);
2227
2480
  this.GM.removeGraphicParam(id);
2228
2481
  } else {
2229
2482
  return false;
2230
2483
  }
2484
+
2231
2485
  for (var i = 0; i < t.movePoints.length; i++) {
2232
2486
  if (t.movePoints[i].id == id) {
2233
2487
  t.movePoints.splice(i, 1);
2234
2488
  continue;
2235
2489
  }
2236
- }
2237
- //清除 state中id的缓存
2490
+ } //清除 state中id的缓存
2491
+
2492
+
2238
2493
  var ids = [];
2494
+
2239
2495
  switch (type) {
2240
2496
  case 'point':
2241
2497
  ids = t.state.pointIds;
2242
2498
  break;
2499
+
2243
2500
  case 'line':
2244
2501
  ids = t.state.lineIds;
2245
2502
  break;
2503
+
2246
2504
  case 'polygon':
2247
2505
  ids = t.state.polygonIds;
2248
2506
  break;
2507
+
2249
2508
  case 'circle':
2250
2509
  ids = t.state.circleIds;
2251
2510
  break;
2511
+
2252
2512
  case 'draw':
2253
2513
  if (t.state.drawIds.point.indexOf(id) > -1) {
2254
2514
  t.state.drawIds.point.splice(t.state.drawIds.point.indexOf(id), 1);
2255
2515
  }
2516
+
2256
2517
  if (t.state.drawIds.polyline.indexOf(id) > -1) {
2257
2518
  t.state.drawIds.polyline.splice(t.state.drawIds.polyline.indexOf(id), 1);
2258
2519
  }
2520
+
2259
2521
  if (t.state.drawIds.polygon.indexOf(id) > -1) {
2260
2522
  t.state.drawIds.polygon.splice(t.state.drawIds.polygon.indexOf(id), 1);
2261
2523
  }
2524
+
2262
2525
  if (t.state.drawIds.circle.indexOf(id) > -1) {
2263
2526
  t.state.drawIds.circle.splice(t.state.drawIds.circle.indexOf(id), 1);
2264
2527
  }
2528
+
2265
2529
  if (t.state.drawIds.rectangle.indexOf(id) > -1) {
2266
2530
  t.state.drawIds.rectangle.splice(t.state.drawIds.rectangle.indexOf(id), 1);
2267
2531
  }
2532
+
2268
2533
  break;
2534
+
2269
2535
  default:
2270
2536
  if (t.state.pointIds.indexOf(id) > -1) {
2271
2537
  t.state.pointIds.splice(t.state.pointIds.indexOf(id), 1);
2272
2538
  }
2539
+
2273
2540
  if (t.state.lineIds.indexOf(id) > -1) {
2274
2541
  t.state.lineIds.splice(t.state.lineIds.indexOf(id), 1);
2275
2542
  }
2543
+
2276
2544
  if (t.state.polygonIds.indexOf(id) > -1) {
2277
2545
  t.state.polygonIds.splice(t.state.polygonIds.indexOf(id), 1);
2278
2546
  }
2547
+
2279
2548
  if (t.state.circleIds.indexOf(id) > -1) {
2280
2549
  t.state.circleIds.splice(t.state.circleIds.indexOf(id), 1);
2281
2550
  }
2551
+
2282
2552
  break;
2283
2553
  }
2554
+
2284
2555
  if (id == t.state.editId) {
2285
2556
  t.state.editId = '';
2286
2557
  }
2558
+
2287
2559
  if (ids.indexOf(id) != -1) {
2288
2560
  ids.splice(ids.indexOf(id), 1);
2289
2561
  }
2290
- }
2291
- //点击图元事件
2562
+ } //点击图元事件
2563
+
2292
2564
  }, {
2293
2565
  key: "clickGraphic",
2294
2566
  value: function clickGraphic(id, e) {
2295
2567
  var t = this;
2568
+
2296
2569
  if (typeof t.props.clickGraphic === "function") {
2297
2570
  var param = t.getGraphic(id);
2298
2571
  var obj = {
@@ -2310,16 +2583,18 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2310
2583
  };
2311
2584
  t.props.clickGraphic(obj);
2312
2585
  }
2313
- }
2314
- //图元鼠标悬浮事件
2586
+ } //图元鼠标悬浮事件
2587
+
2315
2588
  }, {
2316
2589
  key: "mouseOverGraphic",
2317
2590
  value: function mouseOverGraphic(id, e) {
2318
2591
  var t = this;
2592
+
2319
2593
  if (typeof t.props.mouseOverGraphic === 'function') {
2320
2594
  if (id === t.isEditId) {
2321
2595
  return false;
2322
2596
  }
2597
+
2323
2598
  var obj = {
2324
2599
  e: e,
2325
2600
  id: id,
@@ -2330,16 +2605,18 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2330
2605
  };
2331
2606
  t.props.mouseOverGraphic(obj);
2332
2607
  }
2333
- }
2334
- //图元鼠标移开事件
2608
+ } //图元鼠标移开事件
2609
+
2335
2610
  }, {
2336
2611
  key: "mouseOutGraphic",
2337
2612
  value: function mouseOutGraphic(id, e) {
2338
2613
  var t = this;
2614
+
2339
2615
  if (typeof t.props.mouseOutGraphic === "function") {
2340
2616
  if (id === t.isEditId) {
2341
2617
  return false;
2342
2618
  }
2619
+
2343
2620
  var obj = {
2344
2621
  e: e,
2345
2622
  id: id,
@@ -2350,95 +2627,105 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2350
2627
  };
2351
2628
  t.props.mouseOutGraphic(obj);
2352
2629
  }
2353
- }
2354
- //拖拽地图开始
2630
+ } //拖拽地图开始
2631
+
2355
2632
  }, {
2356
2633
  key: "dragMapStart",
2357
2634
  value: function dragMapStart() {
2358
2635
  var t = this;
2636
+
2359
2637
  if (typeof t.props.dragMapStart === "function") {
2360
2638
  t.state.gis.addEventListener('dragstart', function (e) {
2361
2639
  var obj = t.getMapExtent();
2362
- obj.e = e;
2363
- //处理下数据,符合拖拽事件
2640
+ obj.e = e; //处理下数据,符合拖拽事件
2641
+
2364
2642
  t.props.dragMapStart(obj);
2365
2643
  });
2366
2644
  }
2367
- }
2368
- //拖拽地图结束事件
2645
+ } //拖拽地图结束事件
2646
+
2369
2647
  }, {
2370
2648
  key: "dragMapEnd",
2371
2649
  value: function dragMapEnd() {
2372
2650
  var t = this;
2651
+
2373
2652
  if (typeof t.props.dragMapEnd === "function") {
2374
2653
  t.state.gis.addEventListener('dragend', function (e) {
2375
2654
  var obj = t.getMapExtent();
2376
- obj.e = e;
2377
- //处理下数据,符合拖拽事件
2655
+ obj.e = e; //处理下数据,符合拖拽事件
2656
+
2378
2657
  t.props.dragMapEnd(obj);
2379
2658
  });
2380
2659
  }
2381
- }
2382
- //地图移动开始事件
2660
+ } //地图移动开始事件
2661
+
2383
2662
  }, {
2384
2663
  key: "moveStart",
2385
2664
  value: function moveStart() {
2386
2665
  var t = this;
2666
+
2387
2667
  if (typeof t.props.moveStart === "function") {
2388
2668
  t.state.gis.addEventListener('movestart', function (e) {
2389
2669
  if (!t.isZoom) {
2390
2670
  var obj = t.getMapExtent();
2391
- obj.e = e;
2392
- //处理下数据,符合拖拽事件
2671
+ obj.e = e; //处理下数据,符合拖拽事件
2672
+
2393
2673
  t.props.moveStart(obj);
2394
2674
  }
2395
2675
  });
2396
2676
  }
2397
- }
2398
- //地图移动结束事件
2677
+ } //地图移动结束事件
2678
+
2399
2679
  }, {
2400
2680
  key: "moveEnd",
2401
2681
  value: function moveEnd() {
2402
2682
  var t = this;
2683
+
2403
2684
  if (typeof t.props.moveEnd === "function") {
2404
2685
  t.state.gis.addEventListener('moveend', function (e) {
2405
2686
  var xylist = [],
2406
- mapPane = t.state.gis.getPanes().mapPane;
2687
+ mapPane = t.state.gis.getPanes().mapPane;
2688
+
2407
2689
  if (mapPane.style.top) {
2408
2690
  xylist = [mapPane.style.left, mapPane.style.top];
2409
2691
  } else {
2410
2692
  var matchList = mapPane.style.transform.match(/translate\((-?\d*)+px,\s*(-?\d*)+px\)/) || mapPane.style.transform.match(/translate3d\((-?\d*)+px,\s*(-?\d*)+px,\s*(-?\d*)+px\)/) || [];
2411
2693
  xylist = [matchList[1], matchList[2]];
2412
- }
2413
- //重画海量点
2694
+ } //重画海量点
2695
+
2696
+
2414
2697
  $("#".concat(t.pointCollectionId)).css({
2415
2698
  top: "".concat(-xylist[1], "px"),
2416
2699
  left: "".concat(-xylist[0], "px")
2417
2700
  });
2701
+
2418
2702
  if (t.morepoints.length > 0) {
2419
2703
  t.updatePointCollection(t.props.mapPointCollection);
2420
2704
  }
2705
+
2421
2706
  if (t.isZoom) {
2422
2707
  t.isZoom = false;
2423
2708
  } else {
2424
2709
  var obj = t.getMapExtent();
2425
- obj.e = e;
2426
- //处理下数据,符合拖拽事件
2710
+ obj.e = e; //处理下数据,符合拖拽事件
2711
+
2427
2712
  t.props.moveEnd(obj);
2428
2713
  }
2429
2714
  });
2430
2715
  }
2431
- }
2432
- //地图更改缩放级别开始时触发触发此事件
2716
+ } //地图更改缩放级别开始时触发触发此事件
2717
+
2433
2718
  }, {
2434
2719
  key: "zoomStart",
2435
2720
  value: function zoomStart() {
2436
2721
  var t = this;
2722
+
2437
2723
  if (typeof t.props.zoomStart === "function") {
2438
2724
  t.state.gis.addEventListener('zoomstart', function (e) {
2439
2725
  if (t.heatmap && !t.isHideHeatMap) {
2440
2726
  t.heatmap.hide();
2441
2727
  }
2728
+
2442
2729
  $("#".concat(t.pointCollectionId)).css({
2443
2730
  display: 'none'
2444
2731
  });
@@ -2448,43 +2735,49 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2448
2735
  t.props.zoomStart(obj);
2449
2736
  });
2450
2737
  }
2451
- }
2452
- //地图更改缩放级别结束时触发触发此事件
2738
+ } //地图更改缩放级别结束时触发触发此事件
2739
+
2453
2740
  }, {
2454
2741
  key: "zoomEnd",
2455
2742
  value: function zoomEnd() {
2456
2743
  var t = this;
2744
+
2457
2745
  if (typeof t.props.zoomEnd === "function") {
2458
2746
  t.state.gis.addEventListener('zoomend', function (e) {
2459
2747
  //重画热力图
2460
2748
  if (t.heatmap && !t.isHideHeatMap) {
2461
2749
  t.heatmap.show();
2462
2750
  t.heatmap.draw();
2463
- }
2464
- //重画海量点
2751
+ } //重画海量点
2752
+
2753
+
2465
2754
  $("#".concat(t.pointCollectionId)).css({
2466
2755
  display: 'inline-block'
2467
2756
  });
2757
+
2468
2758
  if (t.morepoints.length > 0) {
2469
2759
  t.updatePointCollection(t.props.mapPointCollection);
2470
- }
2471
- //避免zoom切换后,chrome的旋转角度被替换
2760
+ } //避免zoom切换后,chrome的旋转角度被替换
2761
+
2762
+
2472
2763
  for (var i in t.GM.allParam) {
2473
2764
  if (t.GM.allParam[i].geometryType == 'point' && t.GM.allParam[i].deg) {
2474
2765
  t.GM.getGraphic(i).getElement().style.transform = t.GM.getGraphic(i).getElement().style.transform + " rotate(".concat(t.GM.allParam[i].deg, "deg)");
2475
2766
  }
2476
2767
  }
2768
+
2477
2769
  var obj = t.getMapExtent();
2478
2770
  obj.e = e;
2479
2771
  t.props.zoomEnd(obj);
2480
2772
  });
2481
2773
  }
2482
- }
2483
- //地图点击事件
2774
+ } //地图点击事件
2775
+
2484
2776
  }, {
2485
2777
  key: "clickMap",
2486
2778
  value: function clickMap() {
2487
2779
  var t = this;
2780
+
2488
2781
  if (typeof t.props.clickMap === "function") {
2489
2782
  t.state.gis.addEventListener('click', function (e) {
2490
2783
  if (t.isNotClickMap) {
@@ -2498,22 +2791,24 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2498
2791
  }
2499
2792
  });
2500
2793
  }
2501
- }
2502
- //点的跳动动画
2794
+ } //点的跳动动画
2795
+
2503
2796
  }, {
2504
2797
  key: "pointAnimation",
2505
2798
  value: function pointAnimation(id, marker) {
2506
- var t = this;
2507
- //null时关闭跳动
2799
+ var t = this; //null时关闭跳动
2800
+
2508
2801
  if (!!marker) {
2509
2802
  if (t.animTimer[id]) {
2510
2803
  clearInterval(t.animTimer[id]);
2511
2804
  }
2805
+
2512
2806
  t.animTimer[id] = setInterval(function () {
2513
2807
  //点被隐藏时,没有执行,定时不关
2514
2808
  if (marker.getIcon()) {
2515
- var shape = _objectSpread({}, marker.getIcon().getIconAnchor());
2516
- //初始数据 点位有变动,重新刷新数据
2809
+ var shape = _objectSpread({}, marker.getIcon().getIconAnchor()); //初始数据 点位有变动,重新刷新数据
2810
+
2811
+
2517
2812
  if (!t.animCount[id] || shape.y != t.animCount[id].now) {
2518
2813
  t.animCount[id] = {
2519
2814
  start: shape.y,
@@ -2521,12 +2816,15 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2521
2816
  notation: -1
2522
2817
  };
2523
2818
  }
2819
+
2524
2820
  if (t.animCount[id].now - t.animCount[id].start == 20) {
2525
2821
  t.animCount[id].notation = -1;
2526
2822
  }
2823
+
2527
2824
  if (t.animCount[id].now - t.animCount[id].start == 0) {
2528
2825
  t.animCount[id].notation = 1;
2529
2826
  }
2827
+
2530
2828
  shape.y = t.animCount[id].now = t.animCount[id].now + t.animCount[id].notation * 2;
2531
2829
  marker.getIcon().setIconAnchor(shape);
2532
2830
  }
@@ -2539,69 +2837,84 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2539
2837
  key: "moveAnimation",
2540
2838
  value: function moveAnimation() {
2541
2839
  var _this11 = this;
2840
+
2542
2841
  var t = this;
2842
+
2543
2843
  if (t.moveToTimer) {
2544
2844
  clearInterval(t.moveToTimer);
2545
2845
  }
2846
+
2546
2847
  t.moveToTimer = setInterval(function () {
2547
2848
  for (var i = 0; i < t.movePoints.length; i++) {
2548
2849
  t.movePoints[i].waitTime += _this11.timer;
2549
2850
  t.movePoints[i].deleteTime -= _this11.timer;
2550
2851
  }
2852
+
2551
2853
  t.movePoints.sort(function (x, y) {
2552
2854
  return y.waitTime - x.waitTime;
2553
2855
  });
2554
2856
  var nowMovePoints = t.movePoints.slice(0, 10),
2555
- deleteIndex = [];
2857
+ deleteIndex = [];
2858
+
2556
2859
  for (var _i = 0; _i < nowMovePoints.length; _i++) {
2557
2860
  var _nowMovePoints$_i = nowMovePoints[_i],
2558
- id = _nowMovePoints$_i.id,
2559
- oleLng = _nowMovePoints$_i.oleLng,
2560
- oldLat = _nowMovePoints$_i.oldLat,
2561
- rx = _nowMovePoints$_i.rx,
2562
- ry = _nowMovePoints$_i.ry,
2563
- deleteTime = _nowMovePoints$_i.deleteTime,
2564
- totalTime = _nowMovePoints$_i.totalTime,
2565
- ddeg = _nowMovePoints$_i.ddeg;
2861
+ id = _nowMovePoints$_i.id,
2862
+ oleLng = _nowMovePoints$_i.oleLng,
2863
+ oldLat = _nowMovePoints$_i.oldLat,
2864
+ rx = _nowMovePoints$_i.rx,
2865
+ ry = _nowMovePoints$_i.ry,
2866
+ deleteTime = _nowMovePoints$_i.deleteTime,
2867
+ totalTime = _nowMovePoints$_i.totalTime,
2868
+ ddeg = _nowMovePoints$_i.ddeg;
2566
2869
  var gc = t.GM.getGraphic(id);
2870
+
2567
2871
  if (!gc) {
2568
2872
  clearInterval(t.moveToTimer[id]);
2569
2873
  } else {
2570
2874
  var tx = oleLng + rx * ((totalTime - deleteTime) / _this11.timer),
2571
- ty = oldLat + ry * ((totalTime - deleteTime) / _this11.timer);
2875
+ ty = oldLat + ry * ((totalTime - deleteTime) / _this11.timer);
2572
2876
  var lglt = new T.LngLat(tx, ty);
2877
+
2573
2878
  if (t.movePoints[_i].url) {
2574
2879
  gc.getIcon().setIconUrl(t.movePoints[_i].url);
2575
2880
  }
2881
+
2576
2882
  gc.setLngLat(lglt);
2577
2883
  t.GM.setGraphicParam(id, _objectSpread(_objectSpread({}, t.GM.getGraphicParam(id)), {}, {
2578
2884
  deg: ddeg
2579
- }));
2580
- //旋转角度
2885
+ })); //旋转角度
2886
+
2581
2887
  gc.getElement().style.transform = gc.getElement().style.transform + " rotate(".concat(ddeg, "deg)");
2582
2888
  gc.getElement().style['-ms-transform'] = " rotate(".concat(ddeg, "deg)");
2889
+
2583
2890
  if (gc.label) {
2584
2891
  gc.showLabel();
2585
- }
2586
- // 移动过的 放后面再动
2892
+ } // 移动过的 放后面再动
2893
+
2894
+
2587
2895
  t.movePoints[_i].waitTime = 0;
2896
+
2588
2897
  if (deleteTime <= 0) {
2589
2898
  deleteIndex.push(_i);
2590
2899
  }
2591
2900
  }
2592
2901
  }
2902
+
2593
2903
  deleteIndex.sort(function (a, b) {
2594
2904
  return b - a;
2595
2905
  });
2906
+
2596
2907
  for (var _i2 = 0; _i2 < deleteIndex.length; _i2++) {
2597
2908
  t.movePoints.splice(deleteIndex[_i2], 1);
2598
2909
  }
2910
+
2599
2911
  if (nowMovePoints.length == 0) {
2600
2912
  clearInterval(t.moveToTimer);
2601
2913
  }
2602
2914
  }, 10);
2603
2915
  }
2604
2916
  /*公共方法*/
2917
+
2605
2918
  }, {
2606
2919
  key: "moveTo",
2607
2920
  value: function moveTo(id, lnglat, delay, autoRotation, urlright, urlleft) {
@@ -2609,29 +2922,33 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2609
2922
  var t = this;
2610
2923
  delay = eval(delay) * 1000;
2611
2924
  var count = delay / this.timer,
2612
- gc = this.GM.getGraphic(id);
2925
+ gc = this.GM.getGraphic(id);
2613
2926
  var s = gc.getLngLat(),
2614
- e = new T.LngLat(lnglat[0], lnglat[1]);
2927
+ e = new T.LngLat(lnglat[0], lnglat[1]);
2928
+
2615
2929
  if (s.equals(e)) {
2616
2930
  return false;
2617
2931
  } else {
2618
2932
  var ddeg = 0,
2619
- url = null;
2620
- //计算角度,旋转
2933
+ url = null; //计算角度,旋转
2934
+
2621
2935
  if (autoRotation) {
2622
2936
  //自己实现旋转
2623
2937
  ddeg = t.rotateDeg(gc.getLngLat(), lnglat);
2938
+
2624
2939
  if (urlleft && ddeg < -90 && ddeg > -270) {
2625
2940
  ddeg += 180;
2626
2941
  url = urlleft;
2627
2942
  } else {
2628
2943
  url = urlright;
2629
2944
  }
2630
- }
2631
- //拆分延迟移动定位
2945
+ } //拆分延迟移动定位
2946
+
2947
+
2632
2948
  var rx = (e.lng - s.lng) / count,
2633
- ry = (e.lat - s.lat) / count;
2949
+ ry = (e.lat - s.lat) / count;
2634
2950
  var isHave = false;
2951
+
2635
2952
  for (var i = 0; i < t.movePoints.length; i++) {
2636
2953
  if (t.movePoints[i].id == id) {
2637
2954
  t.movePoints.splice(i, 1, {
@@ -2649,6 +2966,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2649
2966
  isHave = true;
2650
2967
  }
2651
2968
  }
2969
+
2652
2970
  if (!isHave) {
2653
2971
  t.movePoints.push({
2654
2972
  oleLng: s.lng,
@@ -2664,30 +2982,34 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2664
2982
  });
2665
2983
  }
2666
2984
  }
2667
- }
2668
- //点位角度旋转(以指向东(右)为0°)
2985
+ } //点位角度旋转(以指向东(右)为0°)
2986
+
2669
2987
  }, {
2670
2988
  key: "rotateDeg",
2671
2989
  value: function rotateDeg(sp, ep) {
2672
2990
  var t = this;
2673
2991
  var spLngLat = sp;
2992
+
2674
2993
  if (Array.isArray(sp)) {
2675
2994
  spLngLat = new AMap.LngLat(sp[0], sp[1]);
2676
2995
  }
2996
+
2677
2997
  var s = t.state.gis.lngLatToLayerPoint(spLngLat),
2678
- //获取当前点位的经纬度
2679
- e = t.state.gis.lngLatToLayerPoint(new T.LngLat(ep[0], ep[1])),
2680
- deg = 0;
2998
+ //获取当前点位的经纬度
2999
+ e = t.state.gis.lngLatToLayerPoint(new T.LngLat(ep[0], ep[1])),
3000
+ deg = 0;
3001
+
2681
3002
  if (e.x != s.x) {
2682
3003
  var tan = (e.y - s.y) / (e.x - s.x),
2683
- atan = Math.atan(tan);
2684
- deg = atan * 360 / (2 * Math.PI);
2685
- //degree correction;
3004
+ atan = Math.atan(tan);
3005
+ deg = atan * 360 / (2 * Math.PI); //degree correction;
3006
+
2686
3007
  if (e.x < s.x) {
2687
3008
  deg = -deg + 90 + 90;
2688
3009
  } else {
2689
3010
  deg = -deg;
2690
3011
  }
3012
+
2691
3013
  deg = -deg;
2692
3014
  } else {
2693
3015
  var disy = e.y - s.y;
@@ -2696,15 +3018,16 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2696
3018
  if (disy == 0) bias = 0;
2697
3019
  deg = -bias * 90;
2698
3020
  }
3021
+
2699
3022
  return deg;
2700
- }
2701
- //对比对象数据是否相等
3023
+ } //对比对象数据是否相等
3024
+
2702
3025
  }, {
2703
3026
  key: "deepEqual",
2704
3027
  value: function deepEqual(a, b) {
2705
3028
  return _immutable["default"].is(_immutable["default"].fromJS(a), _immutable["default"].fromJS(b));
2706
- }
2707
- //计算2点间距离 单位m 精确到个位
3029
+ } //计算2点间距离 单位m 精确到个位
3030
+
2708
3031
  }, {
2709
3032
  key: "calculatePointsDistance",
2710
3033
  value: function calculatePointsDistance(f, s) {
@@ -2716,10 +3039,12 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2716
3039
  key: "calculateDistance",
2717
3040
  value: function calculateDistance(ps) {
2718
3041
  var t = this,
2719
- totalDistance = 0;
3042
+ totalDistance = 0;
3043
+
2720
3044
  if (ps.length < 0) {
2721
3045
  return false;
2722
3046
  }
3047
+
2723
3048
  for (var i = 0; i < ps.length; i++) {
2724
3049
  if (i < ps.length - 1) {
2725
3050
  if ('distanceTo' in ps[i]) {
@@ -2729,9 +3054,10 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2729
3054
  }
2730
3055
  }
2731
3056
  }
3057
+
2732
3058
  return Math.round(totalDistance * 100) / 100;
2733
- }
2734
- //数据解析(分析,新增,更新,删除对应的数据)
3059
+ } //数据解析(分析,新增,更新,删除对应的数据)
3060
+
2735
3061
  }, {
2736
3062
  key: "dataMatch",
2737
3063
  value: function dataMatch(oldData, newData, type) {
@@ -2762,13 +3088,14 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2762
3088
  updatedData: updatedData,
2763
3089
  replacedData: replacedData
2764
3090
  };
2765
- }
2766
- //处理需要增加图元的数据(避免意外问题)
3091
+ } //处理需要增加图元的数据(避免意外问题)
3092
+
2767
3093
  }, {
2768
3094
  key: "dealAdd",
2769
3095
  value: function dealAdd(ary, ids) {
2770
3096
  var ads = [],
2771
- otherupds = [];
3097
+ otherupds = [];
3098
+
2772
3099
  for (var i = 0; i < ary.length; i++) {
2773
3100
  if (ids.indexOf(ary[i].id) > -1) {
2774
3101
  otherupds.push(ary[i]);
@@ -2776,17 +3103,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2776
3103
  ads.push(ary[i]);
2777
3104
  }
2778
3105
  }
3106
+
2779
3107
  return {
2780
3108
  ads: ads,
2781
3109
  otherupds: otherupds
2782
3110
  };
2783
- }
2784
- //处理需要更新图元的数据(避免意外问题)
3111
+ } //处理需要更新图元的数据(避免意外问题)
3112
+
2785
3113
  }, {
2786
3114
  key: "dealUpdate",
2787
3115
  value: function dealUpdate(ary, ids) {
2788
3116
  var upds = [],
2789
- otherads = [];
3117
+ otherads = [];
3118
+
2790
3119
  for (var i = 0; i < ary.length; i++) {
2791
3120
  if (ids.indexOf(ary[i].id) > -1) {
2792
3121
  upds.push(ary[i]);
@@ -2794,6 +3123,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2794
3123
  otherads.push(ary[i]);
2795
3124
  }
2796
3125
  }
3126
+
2797
3127
  return {
2798
3128
  upds: upds,
2799
3129
  otherads: otherads
@@ -2817,6 +3147,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2817
3147
  } else {
2818
3148
  var list = result.pois.map(function (r) {
2819
3149
  var lnglat = {};
3150
+
2820
3151
  if (r.lonlat.indexOf(",") > -1) {
2821
3152
  lnglat = {
2822
3153
  longitude: r.lonlat.split(',')[0],
@@ -2828,6 +3159,7 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2828
3159
  latitude: r.lonlat.split(' ')[1]
2829
3160
  };
2830
3161
  }
3162
+
2831
3163
  return _objectSpread(_objectSpread({
2832
3164
  id: r.hotPointID
2833
3165
  }, lnglat), {}, {
@@ -2842,8 +3174,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2842
3174
  resolve(list);
2843
3175
  }
2844
3176
  }
2845
- };
2846
- //创建搜索对象
3177
+ }; //创建搜索对象
3178
+
2847
3179
  var localsearch = new T.LocalSearch(t.state.gis, searchConfig);
2848
3180
  localsearch.search(searchValue);
2849
3181
  });
@@ -2868,8 +3200,8 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2868
3200
  this.loadMapComplete.then(function () {
2869
3201
  t.mapLeft = document.getElementById(t.props.mapId).offsetLeft;
2870
3202
  t.mapTop = document.getElementById(t.props.mapId).offsetTop;
2871
- t.init();
2872
- //初始化完成后,再走更新
3203
+ t.init(); //初始化完成后,再走更新
3204
+
2873
3205
  t.isLoading = true;
2874
3206
  });
2875
3207
  }
@@ -2880,103 +3212,109 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2880
3212
  var t = this;
2881
3213
  }
2882
3214
  }, {
2883
- key: "componentWillReceiveProps",
2884
- value: function componentWillReceiveProps(nextProps, prevProps) {
3215
+ key: "UNSAFE_componentWillReceiveProps",
3216
+ value: function UNSAFE_componentWillReceiveProps(nextProps, prevProps) {
2885
3217
  //已加载组件,收到新的参数时调用
2886
3218
  var t = this;
3219
+
2887
3220
  var receive = function receive() {
2888
3221
  //点/线旧数据
2889
3222
  var _t$state2 = t.state,
2890
- pointIds = _t$state2.pointIds,
2891
- lineIds = _t$state2.lineIds,
2892
- polygonIds = _t$state2.polygonIds,
2893
- circleIds = _t$state2.circleIds,
2894
- drawIds = _t$state2.drawIds;
3223
+ pointIds = _t$state2.pointIds,
3224
+ lineIds = _t$state2.lineIds,
3225
+ polygonIds = _t$state2.polygonIds,
3226
+ circleIds = _t$state2.circleIds,
3227
+ drawIds = _t$state2.drawIds;
2895
3228
  var point = drawIds.point,
2896
- polyline = drawIds.polyline,
2897
- polygon = drawIds.polygon,
2898
- circle = drawIds.circle,
2899
- rectangle = drawIds.rectangle;
2900
- //点/线新数据
3229
+ polyline = drawIds.polyline,
3230
+ polygon = drawIds.polygon,
3231
+ circle = drawIds.circle,
3232
+ rectangle = drawIds.rectangle; //点/线新数据
3233
+
2901
3234
  var _nextProps$mapPoints = nextProps.mapPoints,
2902
- mapPoints = _nextProps$mapPoints === void 0 ? [] : _nextProps$mapPoints,
2903
- _nextProps$mapLines = nextProps.mapLines,
2904
- mapLines = _nextProps$mapLines === void 0 ? [] : _nextProps$mapLines,
2905
- _nextProps$mapPolygon = nextProps.mapPolygons,
2906
- mapPolygons = _nextProps$mapPolygon === void 0 ? [] : _nextProps$mapPolygon,
2907
- _nextProps$mapCircles = nextProps.mapCircles,
2908
- mapCircles = _nextProps$mapCircles === void 0 ? [] : _nextProps$mapCircles,
2909
- _nextProps$customized = nextProps.customizedBoundary,
2910
- customizedBoundary = _nextProps$customized === void 0 ? [] : _nextProps$customized,
2911
- isOpenTrafficInfo = nextProps.isOpenTrafficInfo,
2912
- boundaryName = nextProps.boundaryName,
2913
- heatMapData = nextProps.heatMapData,
2914
- imageOverlays = nextProps.imageOverlays,
2915
- mapVisiblePoints = nextProps.mapVisiblePoints,
2916
- setVisiblePoints = nextProps.setVisiblePoints,
2917
- setCenter = nextProps.setCenter,
2918
- mapCenter = nextProps.mapCenter,
2919
- setZoomLevel = nextProps.setZoomLevel,
2920
- mapZoomLevel = nextProps.mapZoomLevel,
2921
- setCluster = nextProps.setCluster,
2922
- mapCluster = nextProps.mapCluster,
2923
- isRangingTool = nextProps.isRangingTool,
2924
- mapRangingTool = nextProps.mapRangingTool,
2925
- isRemove = nextProps.isRemove,
2926
- mapRemove = nextProps.mapRemove,
2927
- mapDraw = nextProps.mapDraw,
2928
- isDraw = nextProps.isDraw,
2929
- isCloseDraw = nextProps.isCloseDraw,
2930
- editGraphicId = nextProps.editGraphicId,
2931
- isDoEdit = nextProps.isDoEdit,
2932
- isEndEdit = nextProps.isEndEdit,
2933
- mapPointCollection = nextProps.mapPointCollection,
2934
- isclearAllPointCollection = nextProps.isclearAllPointCollection,
2935
- isClearAll = nextProps.isClearAll,
2936
- mapStyle = nextProps.mapStyle,
2937
- isSetAreaRestriction = nextProps.isSetAreaRestriction,
2938
- areaRestriction = nextProps.areaRestriction,
2939
- isClearAreaRestriction = nextProps.isClearAreaRestriction,
2940
- coverageType = nextProps.coverageType,
2941
- infoWindowData = nextProps.infoWindowData;
2942
-
2943
- // 等待地图加载
2944
- if (!t.state.mapCreated) return;
2945
- // 设置地图样式
3235
+ mapPoints = _nextProps$mapPoints === void 0 ? [] : _nextProps$mapPoints,
3236
+ _nextProps$mapLines = nextProps.mapLines,
3237
+ mapLines = _nextProps$mapLines === void 0 ? [] : _nextProps$mapLines,
3238
+ _nextProps$mapPolygon = nextProps.mapPolygons,
3239
+ mapPolygons = _nextProps$mapPolygon === void 0 ? [] : _nextProps$mapPolygon,
3240
+ _nextProps$mapCircles = nextProps.mapCircles,
3241
+ mapCircles = _nextProps$mapCircles === void 0 ? [] : _nextProps$mapCircles,
3242
+ _nextProps$customized = nextProps.customizedBoundary,
3243
+ customizedBoundary = _nextProps$customized === void 0 ? [] : _nextProps$customized,
3244
+ isOpenTrafficInfo = nextProps.isOpenTrafficInfo,
3245
+ boundaryName = nextProps.boundaryName,
3246
+ heatMapData = nextProps.heatMapData,
3247
+ imageOverlays = nextProps.imageOverlays,
3248
+ mapVisiblePoints = nextProps.mapVisiblePoints,
3249
+ setVisiblePoints = nextProps.setVisiblePoints,
3250
+ setCenter = nextProps.setCenter,
3251
+ mapCenter = nextProps.mapCenter,
3252
+ setZoomLevel = nextProps.setZoomLevel,
3253
+ mapZoomLevel = nextProps.mapZoomLevel,
3254
+ setCluster = nextProps.setCluster,
3255
+ mapCluster = nextProps.mapCluster,
3256
+ isRangingTool = nextProps.isRangingTool,
3257
+ mapRangingTool = nextProps.mapRangingTool,
3258
+ isRemove = nextProps.isRemove,
3259
+ mapRemove = nextProps.mapRemove,
3260
+ mapDraw = nextProps.mapDraw,
3261
+ isDraw = nextProps.isDraw,
3262
+ isCloseDraw = nextProps.isCloseDraw,
3263
+ editGraphicId = nextProps.editGraphicId,
3264
+ isDoEdit = nextProps.isDoEdit,
3265
+ isEndEdit = nextProps.isEndEdit,
3266
+ mapPointCollection = nextProps.mapPointCollection,
3267
+ isclearAllPointCollection = nextProps.isclearAllPointCollection,
3268
+ isClearAll = nextProps.isClearAll,
3269
+ mapStyle = nextProps.mapStyle,
3270
+ isSetAreaRestriction = nextProps.isSetAreaRestriction,
3271
+ areaRestriction = nextProps.areaRestriction,
3272
+ isClearAreaRestriction = nextProps.isClearAreaRestriction,
3273
+ coverageType = nextProps.coverageType,
3274
+ infoWindowData = nextProps.infoWindowData; // 等待地图加载
3275
+
3276
+ if (!t.mapCreated) return; // 设置地图样式
3277
+
2946
3278
  if (!t.deepEqual(mapStyle, t.props.mapStyle)) {
2947
3279
  if (mapStyle) {
2948
3280
  t.state.gis.setStyle(mapStyle);
2949
3281
  } else {
2950
3282
  t.state.gis.removeStyle();
2951
3283
  }
2952
- }
2953
- // 切换地图矢量图和卫星图背景
3284
+ } // 切换地图矢量图和卫星图背景
3285
+
3286
+
2954
3287
  if (coverageType && !t.deepEqual(coverageType, t.props.coverageType)) {
2955
3288
  t.setMapType(coverageType);
2956
3289
  }
2957
3290
  /*添加海量点*/
3291
+
3292
+
2958
3293
  if (mapPointCollection instanceof Array && t.props.mapPointCollection instanceof Array && !t.deepEqual(mapPointCollection, t.props.mapPointCollection)) {
2959
3294
  var _t$dataMatch = t.dataMatch(t.props.mapPointCollection, mapPointCollection, 'id'),
2960
- deletedDataIDs = _t$dataMatch.deletedDataIDs,
2961
- addedData = _t$dataMatch.addedData,
2962
- updatedData = _t$dataMatch.updatedData;
3295
+ deletedDataIDs = _t$dataMatch.deletedDataIDs,
3296
+ addedData = _t$dataMatch.addedData,
3297
+ updatedData = _t$dataMatch.updatedData;
3298
+
2963
3299
  t.clearPointCollection(deletedDataIDs);
2964
3300
  t.addPointCollection(addedData);
2965
3301
  t.updatePointCollection(updatedData);
2966
3302
  }
3303
+
2967
3304
  if (typeof isclearAllPointCollection == 'boolean' && isclearAllPointCollection || isclearAllPointCollection && isclearAllPointCollection !== t.props.isclearAllPointCollection) {
2968
3305
  t.clearAllPointCollection();
2969
3306
  }
2970
-
2971
3307
  /*点数据处理
2972
3308
  pointData[2]相同的点,执行刷新
2973
3309
  pointData[1]的数据在idsForGraphicId中不存在的,执行新增
2974
3310
  pointData[0]数据中多余的id,执行删除
2975
3311
  */
3312
+
3313
+
2976
3314
  if (mapPoints instanceof Array && t.props.mapPoints instanceof Array && !t.deepEqual(mapPoints, t.props.mapPoints)) {
2977
3315
  var oldMapPoints = t.props.mapPoints;
2978
- var newMapPoints = mapPoints;
2979
- //过滤编辑的图元
3316
+ var newMapPoints = mapPoints; //过滤编辑的图元
3317
+
2980
3318
  if (!!t.state.editId) {
2981
3319
  oldMapPoints = t.props.mapPoints.filter(function (item) {
2982
3320
  return item.id !== editGraphicId;
@@ -2985,41 +3323,50 @@ var TMap = /*#__PURE__*/function (_React$Component) {
2985
3323
  return item.id !== editGraphicId;
2986
3324
  });
2987
3325
  }
3326
+
2988
3327
  var _t$dataMatch2 = t.dataMatch(oldMapPoints, newMapPoints, 'id'),
2989
- _deletedDataIDs = _t$dataMatch2.deletedDataIDs,
2990
- _addedData = _t$dataMatch2.addedData,
2991
- _updatedData = _t$dataMatch2.updatedData;
3328
+ _deletedDataIDs = _t$dataMatch2.deletedDataIDs,
3329
+ _addedData = _t$dataMatch2.addedData,
3330
+ _updatedData = _t$dataMatch2.updatedData;
3331
+
2992
3332
  var _t$dealAdd = t.dealAdd(_addedData, [].concat(_toConsumableArray(pointIds), _toConsumableArray(point))),
2993
- ads = _t$dealAdd.ads,
2994
- otherupds = _t$dealAdd.otherupds;
3333
+ ads = _t$dealAdd.ads,
3334
+ otherupds = _t$dealAdd.otherupds;
3335
+
2995
3336
  var _t$dealUpdate = t.dealUpdate(_updatedData, [].concat(_toConsumableArray(pointIds), _toConsumableArray(point))),
2996
- upds = _t$dealUpdate.upds,
2997
- otherads = _t$dealUpdate.otherads;
2998
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3337
+ upds = _t$dealUpdate.upds,
3338
+ otherads = _t$dealUpdate.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3339
+
3340
+
2999
3341
  var _iterator = _createForOfIteratorHelper(_deletedDataIDs),
3000
- _step;
3342
+ _step;
3343
+
3001
3344
  try {
3002
3345
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3003
3346
  var id = _step.value;
3004
3347
  t.removeGraphic(id, 'point');
3005
- }
3006
- //增加
3348
+ } //增加
3349
+
3007
3350
  } catch (err) {
3008
3351
  _iterator.e(err);
3009
3352
  } finally {
3010
3353
  _iterator.f();
3011
3354
  }
3012
- t.addPoint([].concat(_toConsumableArray(ads), _toConsumableArray(otherads)));
3013
- //更新
3355
+
3356
+ t.addPoint([].concat(_toConsumableArray(ads), _toConsumableArray(otherads))); //更新
3357
+
3014
3358
  t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
3015
3359
  }
3016
3360
  /*
3017
3361
  面数据处理
3018
3362
  先全删除,再新增
3019
3363
  */
3364
+
3365
+
3020
3366
  if (mapPolygons instanceof Array && t.props.mapPolygons instanceof Array && !t.deepEqual(mapPolygons, t.props.mapPolygons)) {
3021
3367
  var oldMapPolygons = t.props.mapPolygons;
3022
3368
  var newMapPolygons = mapPolygons;
3369
+
3023
3370
  if (!!t.state.editId) {
3024
3371
  oldMapPolygons = t.props.mapPolygons.filter(function (item) {
3025
3372
  return item.id !== editGraphicId;
@@ -3028,41 +3375,50 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3028
3375
  return item.id !== editGraphicId;
3029
3376
  });
3030
3377
  }
3378
+
3031
3379
  var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons, 'id'),
3032
- _deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
3033
- _addedData2 = _t$dataMatch3.addedData,
3034
- _updatedData2 = _t$dataMatch3.updatedData;
3380
+ _deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
3381
+ _addedData2 = _t$dataMatch3.addedData,
3382
+ _updatedData2 = _t$dataMatch3.updatedData;
3383
+
3035
3384
  var _t$dealAdd2 = t.dealAdd(_addedData2, [].concat(_toConsumableArray(rectangle), _toConsumableArray(polygon), _toConsumableArray(polygonIds))),
3036
- _ads = _t$dealAdd2.ads,
3037
- _otherupds = _t$dealAdd2.otherupds;
3385
+ _ads = _t$dealAdd2.ads,
3386
+ _otherupds = _t$dealAdd2.otherupds;
3387
+
3038
3388
  var _t$dealUpdate2 = t.dealUpdate(_updatedData2, [].concat(_toConsumableArray(rectangle), _toConsumableArray(polygon), _toConsumableArray(polygonIds))),
3039
- _upds = _t$dealUpdate2.upds,
3040
- _otherads = _t$dealUpdate2.otherads;
3041
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3389
+ _upds = _t$dealUpdate2.upds,
3390
+ _otherads = _t$dealUpdate2.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3391
+
3392
+
3042
3393
  var _iterator2 = _createForOfIteratorHelper(_deletedDataIDs2),
3043
- _step2;
3394
+ _step2;
3395
+
3044
3396
  try {
3045
3397
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3046
3398
  var _id = _step2.value;
3047
3399
  t.removeGraphic(_id, 'polygon');
3048
- }
3049
- //增加
3400
+ } //增加
3401
+
3050
3402
  } catch (err) {
3051
3403
  _iterator2.e(err);
3052
3404
  } finally {
3053
3405
  _iterator2.f();
3054
3406
  }
3055
- t.addPolygon([].concat(_toConsumableArray(_ads), _toConsumableArray(_otherads)));
3056
- //更新
3407
+
3408
+ t.addPolygon([].concat(_toConsumableArray(_ads), _toConsumableArray(_otherads))); //更新
3409
+
3057
3410
  t.updatePolygon([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
3058
3411
  }
3059
3412
  /*
3060
3413
  圆数据处理
3061
3414
  先全删除,再新增
3062
3415
  */
3416
+
3417
+
3063
3418
  if (mapCircles instanceof Array && t.props.mapCircles instanceof Array && !t.deepEqual(mapCircles, t.props.mapCircles)) {
3064
3419
  var oldMapCircles = t.props.mapCircles;
3065
3420
  var newMapCircles = mapCircles;
3421
+
3066
3422
  if (!!t.state.editId) {
3067
3423
  oldMapCircles = t.props.mapCircles.filter(function (item) {
3068
3424
  return item.id !== editGraphicId;
@@ -3071,41 +3427,50 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3071
3427
  return item.id !== editGraphicId;
3072
3428
  });
3073
3429
  }
3430
+
3074
3431
  var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles, 'id'),
3075
- _deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
3076
- _addedData3 = _t$dataMatch4.addedData,
3077
- _updatedData3 = _t$dataMatch4.updatedData;
3432
+ _deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
3433
+ _addedData3 = _t$dataMatch4.addedData,
3434
+ _updatedData3 = _t$dataMatch4.updatedData;
3435
+
3078
3436
  var _t$dealAdd3 = t.dealAdd(_addedData3, [].concat(_toConsumableArray(circleIds), _toConsumableArray(circle))),
3079
- _ads2 = _t$dealAdd3.ads,
3080
- _otherupds2 = _t$dealAdd3.otherupds;
3437
+ _ads2 = _t$dealAdd3.ads,
3438
+ _otherupds2 = _t$dealAdd3.otherupds;
3439
+
3081
3440
  var _t$dealUpdate3 = t.dealUpdate(_updatedData3, [].concat(_toConsumableArray(circleIds), _toConsumableArray(circle))),
3082
- _upds2 = _t$dealUpdate3.upds,
3083
- _otherads2 = _t$dealUpdate3.otherads;
3084
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3441
+ _upds2 = _t$dealUpdate3.upds,
3442
+ _otherads2 = _t$dealUpdate3.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3443
+
3444
+
3085
3445
  var _iterator3 = _createForOfIteratorHelper(_deletedDataIDs3),
3086
- _step3;
3446
+ _step3;
3447
+
3087
3448
  try {
3088
3449
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3089
3450
  var _id2 = _step3.value;
3090
3451
  t.removeGraphic(_id2, 'circle');
3091
- }
3092
- //增加
3452
+ } //增加
3453
+
3093
3454
  } catch (err) {
3094
3455
  _iterator3.e(err);
3095
3456
  } finally {
3096
3457
  _iterator3.f();
3097
3458
  }
3098
- t.addCircle([].concat(_toConsumableArray(_ads2), _toConsumableArray(_otherads2)));
3099
- //更新
3459
+
3460
+ t.addCircle([].concat(_toConsumableArray(_ads2), _toConsumableArray(_otherads2))); //更新
3461
+
3100
3462
  t.updateCircle([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
3101
3463
  }
3102
3464
  /*
3103
3465
  线数据处理
3104
3466
  先全删除,再新增
3105
3467
  */
3468
+
3469
+
3106
3470
  if (mapLines instanceof Array && t.props.mapLines instanceof Array && !t.deepEqual(mapLines, t.props.mapLines)) {
3107
3471
  var oldMapLines = t.props.mapLines;
3108
3472
  var newMapLines = mapLines;
3473
+
3109
3474
  if (!!t.state.editId) {
3110
3475
  oldMapLines = t.props.mapLines.filter(function (item) {
3111
3476
  return item.id !== editGraphicId;
@@ -3114,43 +3479,52 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3114
3479
  return item.id !== editGraphicId;
3115
3480
  });
3116
3481
  }
3482
+
3117
3483
  var _t$dataMatch5 = t.dataMatch(oldMapLines, newMapLines, 'id'),
3118
- _deletedDataIDs4 = _t$dataMatch5.deletedDataIDs,
3119
- _addedData4 = _t$dataMatch5.addedData,
3120
- _updatedData4 = _t$dataMatch5.updatedData;
3484
+ _deletedDataIDs4 = _t$dataMatch5.deletedDataIDs,
3485
+ _addedData4 = _t$dataMatch5.addedData,
3486
+ _updatedData4 = _t$dataMatch5.updatedData;
3487
+
3121
3488
  var _t$dealAdd4 = t.dealAdd(_addedData4, [].concat(_toConsumableArray(lineIds), _toConsumableArray(polyline))),
3122
- _ads3 = _t$dealAdd4.ads,
3123
- _otherupds3 = _t$dealAdd4.otherupds;
3489
+ _ads3 = _t$dealAdd4.ads,
3490
+ _otherupds3 = _t$dealAdd4.otherupds;
3491
+
3124
3492
  var _t$dealUpdate4 = t.dealUpdate(_updatedData4, [].concat(_toConsumableArray(lineIds), _toConsumableArray(polyline))),
3125
- _upds3 = _t$dealUpdate4.upds,
3126
- _otherads3 = _t$dealUpdate4.otherads;
3127
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3493
+ _upds3 = _t$dealUpdate4.upds,
3494
+ _otherads3 = _t$dealUpdate4.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3495
+
3496
+
3128
3497
  var _iterator4 = _createForOfIteratorHelper(_deletedDataIDs4),
3129
- _step4;
3498
+ _step4;
3499
+
3130
3500
  try {
3131
3501
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3132
3502
  var _id3 = _step4.value;
3133
3503
  t.removeGraphic(_id3, 'line');
3134
- }
3135
- //增加
3504
+ } //增加
3505
+
3136
3506
  } catch (err) {
3137
3507
  _iterator4.e(err);
3138
3508
  } finally {
3139
3509
  _iterator4.f();
3140
3510
  }
3141
- t.addLine([].concat(_toConsumableArray(_ads3), _toConsumableArray(_otherads3)));
3142
- //更新
3511
+
3512
+ t.addLine([].concat(_toConsumableArray(_ads3), _toConsumableArray(_otherads3))); //更新
3513
+
3143
3514
  t.updateLine([].concat(_toConsumableArray(_upds3), _toConsumableArray(_otherupds3)));
3144
- }
3145
- //画其他特例线专用
3515
+ } //画其他特例线专用
3516
+
3517
+
3146
3518
  if (customizedBoundary instanceof Array && t.props.customizedBoundary instanceof Array && !t.deepEqual(customizedBoundary, t.props.customizedBoundary)) {
3147
3519
  var _t$dataMatch6 = t.dataMatch(t.props.customizedBoundary, customizedBoundary, 'id'),
3148
- _deletedDataIDs5 = _t$dataMatch6.deletedDataIDs,
3149
- _addedData5 = _t$dataMatch6.addedData,
3150
- _updatedData5 = _t$dataMatch6.updatedData;
3151
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3520
+ _deletedDataIDs5 = _t$dataMatch6.deletedDataIDs,
3521
+ _addedData5 = _t$dataMatch6.addedData,
3522
+ _updatedData5 = _t$dataMatch6.updatedData; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
3523
+
3524
+
3152
3525
  var _iterator5 = _createForOfIteratorHelper(_deletedDataIDs5),
3153
- _step5;
3526
+ _step5;
3527
+
3154
3528
  try {
3155
3529
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3156
3530
  var _id4 = _step5.value;
@@ -3161,10 +3535,10 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3161
3535
  } finally {
3162
3536
  _iterator5.f();
3163
3537
  }
3538
+
3164
3539
  t.updateLine(_updatedData5);
3165
3540
  t.addLine(_addedData5);
3166
- }
3167
- // //绘制边界线
3541
+ } // //绘制边界线
3168
3542
  // if(boundaryName instanceof Array && !t.deepEqual(boundaryName,t.props.boundaryName)){
3169
3543
  // let newBDName = Set(boundaryName);
3170
3544
  // let oldBDName = Set(t.props.boundaryName);
@@ -3174,90 +3548,111 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3174
3548
  // t.addBaiduBoundary(addedBoundaryName);
3175
3549
  // }
3176
3550
  // 获取热力图
3551
+
3552
+
3177
3553
  if (heatMapData && !t.deepEqual(heatMapData, t.props.heatMapData)) {
3178
3554
  t.heatMapOverlay(heatMapData);
3179
- }
3180
- // 打开信息窗体
3555
+ } // 打开信息窗体
3556
+
3557
+
3181
3558
  if (infoWindowData && !t.deepEqual(infoWindowData, t.props.infoWindowData)) {
3182
3559
  t.infoWindow(infoWindowData);
3183
- }
3184
- //添加图片图层
3560
+ } //添加图片图层
3561
+
3562
+
3185
3563
  if (imageOverlays instanceof Array && !t.deepEqual(imageOverlays, t.props.imageOverlays)) {
3186
3564
  t.imageUrlOverlay(imageOverlays);
3187
- }
3188
- //图元编辑调用
3565
+ } //图元编辑调用
3566
+
3567
+
3189
3568
  if (typeof isDoEdit == 'boolean' && isDoEdit || isDoEdit && isDoEdit !== t.props.isDoEdit) {
3190
3569
  t.doEdit(editGraphicId);
3191
- }
3192
- //是否关闭图元编辑
3570
+ } //是否关闭图元编辑
3571
+
3572
+
3193
3573
  if (typeof isEndEdit == 'boolean' && isEndEdit || isEndEdit && isEndEdit !== t.props.isEndEdit) {
3194
3574
  t.endEdit();
3195
3575
  }
3196
3576
  /*设置指定图元展示*/
3577
+
3578
+
3197
3579
  if (typeof setVisiblePoints == 'boolean' && setVisiblePoints || setVisiblePoints && setVisiblePoints !== t.props.setVisiblePoints) {
3198
3580
  t.setVisiblePoints(mapVisiblePoints);
3199
- }
3200
- //绘制图元
3581
+ } //绘制图元
3582
+
3583
+
3201
3584
  if (typeof isDraw == 'boolean' && isDraw || isDraw && isDraw !== t.props.isDraw) {
3202
3585
  t.draw(mapDraw);
3203
- }
3204
- //关闭绘制
3586
+ } //关闭绘制
3587
+
3588
+
3205
3589
  if (typeof isCloseDraw == 'boolean' && isCloseDraw || isCloseDraw && isCloseDraw !== t.props.isCloseDraw) {
3206
3590
  t.closeDraw();
3207
- }
3208
- //清空地图
3591
+ } //清空地图
3592
+
3593
+
3209
3594
  if (typeof isClearAll == 'boolean' && isClearAll || isClearAll && isClearAll !== t.props.isClearAll) {
3210
3595
  t.clearAll();
3211
- }
3212
- //设置中心点
3596
+ } //设置中心点
3597
+
3598
+
3213
3599
  if (typeof setCenter == 'boolean' && setCenter || setCenter && setCenter !== t.props.setCenter) {
3214
3600
  if (!(t.getCurrentCenter().lng == mapCenter[0] && t.getCurrentCenter().lat == mapCenter[1])) {
3215
3601
  t.setCenter(mapCenter);
3216
3602
  }
3217
- }
3218
- //设置比例尺
3603
+ } //设置比例尺
3604
+
3605
+
3219
3606
  if (typeof setZoomLevel == 'boolean' && setZoomLevel || setZoomLevel && setZoomLevel !== t.props.setZoomLevel) {
3220
3607
  if (!(t.getZoomLevel() == mapZoomLevel)) {
3221
3608
  t.setZoomLevel(mapZoomLevel);
3222
3609
  }
3223
- }
3224
- // //是否打开路况
3610
+ } // //是否打开路况
3225
3611
  // if(isOpenTrafficInfo){
3226
3612
  // t.openTrafficInfo();
3227
3613
  // }else{
3228
3614
  // t.hideTrafficInfo();
3229
3615
  // }
3230
3616
  //设置点聚合
3617
+
3618
+
3231
3619
  if (typeof setCluster == 'boolean' && setCluster || setCluster && setCluster !== t.props.setCluster) {
3232
3620
  t.cluster(mapCluster);
3233
- }
3234
- // 清除聚合
3621
+ } // 清除聚合
3622
+
3623
+
3235
3624
  if (!setCluster && setCluster !== t.props.setCluster) {
3236
3625
  t.removeCluster(mapCluster);
3237
- }
3238
- //测距工具调用
3626
+ } //测距工具调用
3627
+
3628
+
3239
3629
  if (typeof isRangingTool == 'boolean' && isRangingTool || isRangingTool && isRangingTool !== t.props.isRangingTool) {
3240
3630
  t.vtxRangingTool();
3241
- }
3242
- //单独删除操作
3631
+ } //单独删除操作
3632
+
3633
+
3243
3634
  if (typeof isRemove == 'boolean' && isRemove || isRemove && isRemove !== t.props.isRemove) {
3244
3635
  mapRemove.map(function (item, index) {
3245
3636
  t.removeGraphic(item.id, item.type);
3246
3637
  });
3247
- }
3248
- //设置区域限制
3638
+ } //设置区域限制
3639
+
3640
+
3249
3641
  if (typeof isSetAreaRestriction == 'boolean' && isSetAreaRestriction || isSetAreaRestriction && isSetAreaRestriction !== t.props.isSetAreaRestriction && areaRestriction && !!areaRestriction[0] && !!areaRestriction[1]) {
3250
3642
  t.setAreaRestriction(areaRestriction);
3251
- }
3252
- //关闭区域限制
3643
+ } //关闭区域限制
3644
+
3645
+
3253
3646
  if (typeof isClearAreaRestriction == 'boolean' && isClearAreaRestriction || isClearAreaRestriction && isClearAreaRestriction !== t.props.isClearAreaRestriction) {
3254
3647
  t.clearAreaRestriction();
3255
3648
  }
3256
3649
  };
3650
+
3257
3651
  if (t.waitReceive) {
3258
3652
  clearInterval(t.waitReceive);
3259
- }
3260
- //等等天地图初始化
3653
+ } //等等天地图初始化
3654
+
3655
+
3261
3656
  if (t.isLoading) {
3262
3657
  receive();
3263
3658
  } else {
@@ -3267,17 +3662,19 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3267
3662
  receive();
3268
3663
  }
3269
3664
  }, 100);
3270
- }
3665
+ } // 比例尺控件位置改变
3666
+
3271
3667
 
3272
- // 比例尺控件位置改变
3273
3668
  if (nextProps.showControl && JSON.stringify(nextProps.showControl) != JSON.stringify(t.props.showControl)) {
3274
3669
  t.showControl(nextProps);
3275
- }
3276
- // 比例尺移除
3670
+ } // 比例尺移除
3671
+
3672
+
3277
3673
  if (!nextProps.showControl) {
3278
3674
  t.removeControl();
3279
- }
3280
- // 地图类型控件位置改变
3675
+ } // 地图类型控件位置改变
3676
+
3677
+
3281
3678
  if (nextProps.satelliteSwitch && JSON.stringify(nextProps.satelliteSwitch) != JSON.stringify(t.props.satelliteSwitch)) {
3282
3679
  t.showMapTypeControl(nextProps);
3283
3680
  }
@@ -3287,26 +3684,34 @@ var TMap = /*#__PURE__*/function (_React$Component) {
3287
3684
  value: function componentWillUnmount() {
3288
3685
  //关闭moveTo定时
3289
3686
  var t = this;
3687
+
3290
3688
  if (t.moveToTimer) {
3291
3689
  clearInterval(t.moveToTimer);
3292
3690
  }
3691
+
3293
3692
  if (t.waitReceive) {
3294
3693
  clearInterval(t.waitReceive);
3295
3694
  }
3695
+
3296
3696
  if (t.waitInit) {
3297
3697
  clearInterval(t.waitInit);
3298
- }
3299
- //关闭animation定时
3698
+ } //关闭animation定时
3699
+
3700
+
3300
3701
  for (var j in t.animTimer) {
3301
3702
  if (t.animTimer[j]) {
3302
3703
  clearInterval(t.animTimer[j]);
3303
3704
  }
3304
3705
  }
3706
+
3305
3707
  if (window.VtxMap && window.VtxMap[t.state.mapId]) window.VtxMap[t.state.mapId] = null;
3306
3708
  }
3307
3709
  }]);
3710
+
3308
3711
  return TMap;
3309
3712
  }(_react["default"].Component);
3310
- var _default = exports["default"] = TMap;
3713
+
3714
+ var _default = TMap;
3715
+ exports["default"] = _default;
3311
3716
  module.exports = exports["default"];
3312
3717
  //# sourceMappingURL=TMap.js.map