@vtx/map 1.1.43 → 1.1.44

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