@vtx/map 1.1.43 → 1.1.44

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