@vtx/map 1.1.49 → 1.1.51

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