@vtx/map 1.1.35 → 1.1.36

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