@vtx/map 1.1.47 → 1.1.49

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