@vtx/map 1.1.43 → 1.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/lib/VtxMap/AMap/AMap.js +1012 -640
  2. package/lib/VtxMap/AMap/AMap.js.map +1 -1
  3. package/lib/VtxMap/BMap/Map.js +1197 -749
  4. package/lib/VtxMap/BMap/Map.js.map +1 -1
  5. package/lib/VtxMap/GMap/Map.js +1564 -1046
  6. package/lib/VtxMap/GMap/Map.js.map +1 -1
  7. package/lib/VtxMap/Map.js +42 -8
  8. package/lib/VtxMap/Map.js.map +1 -1
  9. package/lib/VtxMap/MapToolFunction.js +63 -26
  10. package/lib/VtxMap/MapToolFunction.js.map +1 -1
  11. package/lib/VtxMap/OMap/Map.js +1361 -867
  12. package/lib/VtxMap/OMap/Map.js.map +1 -1
  13. package/lib/VtxMap/OlMap/Map.js +1289 -699
  14. package/lib/VtxMap/OlMap/Map.js.map +1 -1
  15. package/lib/VtxMap/TMap/TMap.js +1058 -651
  16. package/lib/VtxMap/TMap/TMap.js.map +1 -1
  17. package/lib/VtxMap/index.js +8 -1
  18. package/lib/VtxMap/index.js.map +1 -1
  19. package/lib/VtxMap/mapPlayer.js +123 -67
  20. package/lib/VtxMap/mapPlayer.js.map +1 -1
  21. package/lib/VtxMap/optimizingPointMap.js +77 -21
  22. package/lib/VtxMap/optimizingPointMap.js.map +1 -1
  23. package/lib/VtxMap/style/css.js +6 -0
  24. package/lib/VtxMap/style/css.js.map +1 -1
  25. package/lib/VtxMap/style/index.js +6 -0
  26. package/lib/VtxMap/style/index.js.map +1 -1
  27. package/lib/VtxMap/zoomMap.js +41 -12
  28. package/lib/VtxMap/zoomMap.js.map +1 -1
  29. package/lib/VtxModal/VtxModal.js +63 -19
  30. package/lib/VtxModal/VtxModal.js.map +1 -1
  31. package/lib/VtxModal/draggableModal.js +48 -12
  32. package/lib/VtxModal/draggableModal.js.map +1 -1
  33. package/lib/VtxModal/index.js +6 -1
  34. package/lib/VtxModal/index.js.map +1 -1
  35. package/lib/VtxModal/style/css.js +6 -0
  36. package/lib/VtxModal/style/css.js.map +1 -1
  37. package/lib/VtxModal/style/index.js +6 -0
  38. package/lib/VtxModal/style/index.js.map +1 -1
  39. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js +238 -105
  40. package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js.map +1 -1
  41. package/lib/VtxSearchCheckMap/index.js +2 -0
  42. package/lib/VtxSearchCheckMap/index.js.map +1 -1
  43. package/lib/VtxSearchCheckMap/mapping.js +2 -1
  44. package/lib/VtxSearchCheckMap/mapping.js.map +1 -1
  45. package/lib/VtxSearchCheckMap/style/css.js +19 -0
  46. package/lib/VtxSearchCheckMap/style/css.js.map +1 -1
  47. package/lib/VtxSearchCheckMap/style/index.js +19 -0
  48. package/lib/VtxSearchCheckMap/style/index.js.map +1 -1
  49. package/lib/VtxSearchMap/VtxSearchMap.js +220 -89
  50. package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
  51. package/lib/VtxSearchMap/index.js +2 -0
  52. package/lib/VtxSearchMap/index.js.map +1 -1
  53. package/lib/VtxSearchMap/mapping.js +2 -1
  54. package/lib/VtxSearchMap/mapping.js.map +1 -1
  55. package/lib/VtxSearchMap/style/css.js +19 -0
  56. package/lib/VtxSearchMap/style/css.js.map +1 -1
  57. package/lib/VtxSearchMap/style/index.js +19 -0
  58. package/lib/VtxSearchMap/style/index.js.map +1 -1
  59. package/lib/default.js +13 -4
  60. package/lib/default.js.map +1 -1
  61. package/lib/index.js +3 -0
  62. package/lib/index.js.map +1 -1
  63. package/package.json +1 -1
@@ -1,62 +1,106 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _MapToolFunction = require("../MapToolFunction");
13
+
10
14
  var _immutable = _interopRequireDefault(require("immutable"));
15
+
11
16
  var _default2 = _interopRequireDefault(require("../../default"));
17
+
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
13
20
  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; } } }; }
14
- 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; }
15
- 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; }
16
- 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; }
21
+
22
+ 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; }
23
+
24
+ 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; }
25
+
26
+ 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; }
27
+
17
28
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
29
+
18
30
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+
19
32
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
33
+
20
34
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
35
+
21
36
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
37
+
38
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
+
23
40
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
- 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); } }
41
+
42
+ 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); } }
43
+
25
44
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
26
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
27
- 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); }
45
+
28
46
  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); }
47
+
29
48
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
49
+
30
50
  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); }; }
51
+
31
52
  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); }
53
+
32
54
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
55
+
33
56
  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; } }
57
+
34
58
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
- var Set = _immutable["default"].Set;
36
- //公共地址配置
59
+
60
+ var Set = _immutable["default"].Set; //公共地址配置
61
+
37
62
  var Map = /*#__PURE__*/function (_React$Component) {
38
63
  _inherits(Map, _React$Component);
64
+
39
65
  var _super = _createSuper(Map);
66
+
40
67
  function Map(props) {
41
68
  var _this;
69
+
42
70
  _classCallCheck(this, Map);
71
+
43
72
  _this = _super.call(this, props);
44
73
  _this.GM = new _MapToolFunction.graphicManage(); //初始化 图元管理方法
74
+
45
75
  _this.initPointIndex = 0; //初始化地图时记录点当前位置
76
+
46
77
  _this._cluster = null; //点聚合对象
78
+
47
79
  _this.clusterIdList = []; //点聚合id集合
80
+
48
81
  _this._rangingTool = null; //测距对象
82
+
49
83
  _this._bmar = null; //区域限制对象
84
+
50
85
  _this._drawmanager = null; //图元绘制对象
86
+
51
87
  _this.editGraphicChange = null; //编辑方法回调
88
+
52
89
  _this.editTimeout = null; //圆编辑回调延迟时间对象
90
+
53
91
  _this._boundary = null; //获取行政区域数据的对象
92
+
54
93
  _this.moveToTimer = null; //moveTo时间对象
94
+
55
95
  _this.heatmap = null; //热力图对象
96
+
56
97
  _this.morepoints = []; //海量点数组
98
+
57
99
  _this.movePoints = []; //移动点的动画集合
100
+
58
101
  _this.editEvent = {}; //编辑监听的事件
59
102
  //是否绘制测距
103
+
60
104
  _this.rangingTool = {
61
105
  isRanging: false,
62
106
  //是否开启状态
@@ -72,6 +116,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
72
116
  isDbclick: false
73
117
  };
74
118
  _this.rangingTools = {}; //测距点线缓存
119
+
75
120
  _this.state = {
76
121
  gis: null,
77
122
  //地图对象
@@ -102,25 +147,31 @@ var Map = /*#__PURE__*/function (_React$Component) {
102
147
  };
103
148
  _this.cacheImgRecord = {}; //缓存图片记录,避免多次加载缓存
104
149
  // 图片缓存dom位置
150
+
105
151
  var cacheImg = document.getElementById('vtxomapdefaultimg');
152
+
106
153
  if (!cacheImg) {
107
154
  cacheImg = _this.cacheImg = document.createElement('div');
108
155
  cacheImg.id = 'vtxomapcacheImg';
109
156
  cacheImg.style.display = 'none';
110
157
  document.body.appendChild(cacheImg);
111
158
  }
112
- _this.cacheImg = cacheImg;
113
- //缓存默认点位地址
159
+
160
+ _this.cacheImg = cacheImg; //缓存默认点位地址
161
+
114
162
  if (!document.getElementById('vtxomapdefaultimg')) {
115
163
  var defImg = new Image();
116
164
  defImg.src = "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png");
117
165
  defImg.id = 'vtxomapdefaultimg';
118
166
  cacheImg.appendChild(defImg);
119
- }
120
- //加载地图
167
+ } //加载地图
168
+
169
+
121
170
  _this.loadMapJs();
171
+
122
172
  return _this;
123
173
  }
174
+
124
175
  _createClass(Map, [{
125
176
  key: "loadMapJs",
126
177
  value: function loadMapJs() {
@@ -148,67 +199,76 @@ var Map = /*#__PURE__*/function (_React$Component) {
148
199
  });
149
200
  }
150
201
  });
151
- }
152
- //初始化地图数据
202
+ } //初始化地图数据
203
+
153
204
  }, {
154
205
  key: "init",
155
206
  value: function init() {
156
- var t = this;
157
- //创建地图
207
+ var t = this; //创建地图
208
+
158
209
  t.createMap();
159
210
  var _this$props = this.props,
160
- mapPoints = _this$props.mapPoints,
161
- mapLines = _this$props.mapLines,
162
- mapPolygons = _this$props.mapPolygons,
163
- mapCircles = _this$props.mapCircles,
164
- mapVisiblePoints = _this$props.mapVisiblePoints,
165
- mapCluster = _this$props.mapCluster,
166
- mapZoomLevel = _this$props.mapZoomLevel,
167
- isOpenTrafficInfo = _this$props.isOpenTrafficInfo,
168
- mapPointCollection = _this$props.mapPointCollection,
169
- areaRestriction = _this$props.areaRestriction;
211
+ mapPoints = _this$props.mapPoints,
212
+ mapLines = _this$props.mapLines,
213
+ mapPolygons = _this$props.mapPolygons,
214
+ mapCircles = _this$props.mapCircles,
215
+ mapVisiblePoints = _this$props.mapVisiblePoints,
216
+ mapCluster = _this$props.mapCluster,
217
+ mapZoomLevel = _this$props.mapZoomLevel,
218
+ isOpenTrafficInfo = _this$props.isOpenTrafficInfo,
219
+ mapPointCollection = _this$props.mapPointCollection,
220
+ areaRestriction = _this$props.areaRestriction;
170
221
  var _this$props2 = this.props,
171
- boundaryName = _this$props2.boundaryName,
172
- heatMapData = _this$props2.heatMapData,
173
- customizedBoundary = _this$props2.customizedBoundary;
222
+ boundaryName = _this$props2.boundaryName,
223
+ heatMapData = _this$props2.heatMapData,
224
+ customizedBoundary = _this$props2.customizedBoundary;
174
225
  var _this$state = this.state,
175
- boundaryInfo = _this$state.boundaryInfo,
176
- pointIds = _this$state.pointIds,
177
- lineIds = _this$state.lineIds,
178
- polygonIds = _this$state.polygonIds,
179
- circleIds = _this$state.circleIds;
180
- // //添加点
226
+ boundaryInfo = _this$state.boundaryInfo,
227
+ pointIds = _this$state.pointIds,
228
+ lineIds = _this$state.lineIds,
229
+ polygonIds = _this$state.polygonIds,
230
+ circleIds = _this$state.circleIds; // //添加点
231
+
181
232
  if (mapPoints instanceof Array) {
182
233
  t.addPoint(mapPoints);
183
- }
184
- //添加线
234
+ } //添加线
235
+
236
+
185
237
  if (mapLines instanceof Array) {
186
238
  t.addLine(mapLines);
187
- }
188
- //添加面
239
+ } //添加面
240
+
241
+
189
242
  if (mapPolygons instanceof Array) {
190
243
  t.addPolygon(mapPolygons);
191
- }
192
- //添加圆
244
+ } //添加圆
245
+
246
+
193
247
  if (mapCircles instanceof Array) {
194
248
  t.addCircle(mapCircles);
195
- }
196
- // 画热力图
249
+ } // 画热力图
250
+
251
+
197
252
  if (heatMapData) {
198
253
  t.heatMapOverlay(heatMapData);
199
254
  }
255
+
200
256
  if (mapPointCollection instanceof Array) {
201
257
  t.addPointCollection(mapPointCollection);
202
258
  }
203
259
  /*设置指定图元展示*/
260
+
261
+
204
262
  if (mapVisiblePoints) {
205
263
  t.setVisiblePoints(mapVisiblePoints);
206
- }
207
- //设置点聚合
264
+ } //设置点聚合
265
+
266
+
208
267
  if (mapCluster instanceof Array) {
209
268
  t.cluster(mapCluster);
210
- }
211
- //开关路况
269
+ } //开关路况
270
+
271
+
212
272
  if (isOpenTrafficInfo) {
213
273
  t.openTrafficInfo();
214
274
  } else {
@@ -216,63 +276,71 @@ var Map = /*#__PURE__*/function (_React$Component) {
216
276
  }
217
277
  /*地图事件*/
218
278
  //初始化地图点击事件
219
- t.clickMap();
220
- //地图拖动之前事件
221
- t.dragMapStart();
222
- // //地图拖动结束后事件
223
- t.dragMapEnd();
224
- // //地图移动之前事件
225
- t.moveStart();
226
- // //地图缩放开始前事件
227
- t.zoomStart();
228
- // //地图移动结束后事件/地图缩放结束后事件
279
+
280
+
281
+ t.clickMap(); //地图拖动之前事件
282
+
283
+ t.dragMapStart(); // //地图拖动结束后事件
284
+
285
+ t.dragMapEnd(); // //地图移动之前事件
286
+
287
+ t.moveStart(); // //地图缩放开始前事件
288
+
289
+ t.zoomStart(); // //地图移动结束后事件/地图缩放结束后事件
290
+
229
291
  t.moveEndAndZoomEnd();
230
292
  t.setState({
231
293
  mapCreated: true
232
294
  });
233
- }
234
- //创建地图
295
+ } //创建地图
296
+
235
297
  }, {
236
298
  key: "createMap",
237
299
  value: function createMap() {
238
300
  var t = this;
239
301
  var _t$props = t.props,
240
- mapCenter = _t$props.mapCenter,
241
- mapId = _t$props.mapId,
242
- mapZoomLevel = _t$props.mapZoomLevel,
243
- minZoom = _t$props.minZoom,
244
- maxZoom = _t$props.maxZoom,
245
- showControl = _t$props.showControl,
246
- areaRestriction = _t$props.areaRestriction;
302
+ mapCenter = _t$props.mapCenter,
303
+ mapId = _t$props.mapId,
304
+ mapZoomLevel = _t$props.mapZoomLevel,
305
+ minZoom = _t$props.minZoom,
306
+ maxZoom = _t$props.maxZoom,
307
+ showControl = _t$props.showControl,
308
+ areaRestriction = _t$props.areaRestriction;
247
309
  var options = {
248
310
  zoom: mapZoomLevel || 10,
249
311
  center: mapCenter || [626.3002300508477, 37.90942995363547],
250
312
  minZoom: minZoom || 0,
251
313
  maxZoom: maxZoom || 22
252
- };
253
- //缓存 zoom等级,用于事件判断
314
+ }; //缓存 zoom等级,用于事件判断
315
+
254
316
  t.oldZoomLevel = options.zoom;
317
+
255
318
  if (window.VtxMap) {
256
319
  window.VtxMap[mapId] = null;
257
320
  } else {
258
321
  window.VtxMap = {};
259
- }
260
- // 地图控件处理
322
+ } // 地图控件处理
323
+
324
+
261
325
  var isShowControl = false,
262
- controlPosition = t.matchControlPosition();
326
+ controlPosition = t.matchControlPosition();
327
+
263
328
  if (showControl) {
264
329
  controlPosition = t.matchControlPosition(showControl.location);
265
330
  isShowControl = !!showControl;
266
331
  }
332
+
267
333
  var latLngBounds = [];
334
+
268
335
  if (areaRestriction && Array.isArray(areaRestriction) && Array.isArray(areaRestriction[0])) {
269
336
  //处理 区域限制数据
270
337
  latLngBounds = [areaRestriction[0][0], areaRestriction[0][1], areaRestriction[1][0], areaRestriction[1][1]];
271
338
  latLngBounds.sort(function (a, b) {
272
339
  return a - b;
273
340
  });
274
- }
275
- //创建地图 缓存地图对象
341
+ } //创建地图 缓存地图对象
342
+
343
+
276
344
  var map = window.VtxMap[mapId] = t.state.gis = new t.omap.Map(document.getElementById(mapId.toString()), {
277
345
  center: {
278
346
  lng: options.center[0],
@@ -318,40 +386,55 @@ var Map = /*#__PURE__*/function (_React$Component) {
318
386
  }
319
387
  });
320
388
  /*=================================start========================================*/
389
+
321
390
  /*
322
391
  draw对象声明, 绘制返回方法实现
323
392
  */
393
+
324
394
  if (!t._drawmanager) {
325
395
  t._drawmanager = new google.maps.drawing.DrawingManager({
326
396
  drawingControl: false
327
397
  });
398
+
328
399
  t._drawmanager.setMap(t.state.gis);
329
400
  }
330
401
  /*=================================start========================================*/
331
402
  //初始化点聚合对象
403
+
404
+
332
405
  if (!t._cluster) {
333
406
  t._cluster = new OMapLib.MarkerClusterer(map, [], {
334
407
  maxZoom: options.maxZoom
335
408
  });
336
409
  }
337
410
  /*=================================start========================================*/
411
+
338
412
  /*
339
413
  声明OverlayView 类
340
414
  用于切换lnglat和 pixel
341
415
  */
416
+
417
+
342
418
  function CanvasProjectionOverlay() {}
419
+
343
420
  CanvasProjectionOverlay.prototype = new google.maps.OverlayView();
344
421
  CanvasProjectionOverlay.prototype.constructor = CanvasProjectionOverlay;
422
+
345
423
  CanvasProjectionOverlay.prototype.onAdd = function () {};
424
+
346
425
  CanvasProjectionOverlay.prototype.draw = function () {};
426
+
347
427
  CanvasProjectionOverlay.prototype.onRemove = function () {};
428
+
348
429
  this.canvasProjectionOverlay = new CanvasProjectionOverlay();
349
430
  this.canvasProjectionOverlay.setMap(map);
350
431
  /*=================================start========================================*/
432
+
351
433
  /*
352
434
  重写marker对象,支持html
353
435
  要使用google对象,所以在creatMap中声明
354
436
  */
437
+
355
438
  var MyLabel = t.MyLabel = function (map) {
356
439
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
357
440
  //编辑
@@ -359,11 +442,11 @@ var Map = /*#__PURE__*/function (_React$Component) {
359
442
  this.editParam = {
360
443
  sx: 0,
361
444
  sy: 0
362
- };
363
- //地图
445
+ }; //地图
446
+
364
447
  this.map = map;
365
- this.isLabel = options.isLabel;
366
- //基本参数
448
+ this.isLabel = options.isLabel; //基本参数
449
+
367
450
  this.labelClass = options.labelClass;
368
451
  this.labelContent = options.labelContent;
369
452
  this.labelOffset = options.labelOffset || {
@@ -373,19 +456,21 @@ var Map = /*#__PURE__*/function (_React$Component) {
373
456
  this.lnglat = options.lnglat;
374
457
  this._label = null;
375
458
  this.funs = {};
376
- };
377
- //继承OverlayView类
378
- MyLabel.prototype = new google.maps.OverlayView();
379
- //添加地图时被调用(setMap时被调用)
459
+ }; //继承OverlayView类
460
+
461
+
462
+ MyLabel.prototype = new google.maps.OverlayView(); //添加地图时被调用(setMap时被调用)
463
+
380
464
  MyLabel.prototype.onAdd = function () {
381
465
  //创建文字标签
382
466
  if (!this._label) {
383
467
  this._label = document.createElement('div');
384
468
  this._label.innerHTML = this.labelContent;
385
469
  this._label.style.position = 'absolute';
386
- this._label.className = this.labelClass;
387
- //获取承载点位的框
470
+ this._label.className = this.labelClass; //获取承载点位的框
471
+
388
472
  var panes = this.getPanes();
473
+
389
474
  if (this.isLabel) {
390
475
  panes.markerLayer.appendChild(this._label);
391
476
  } else {
@@ -395,23 +480,27 @@ var Map = /*#__PURE__*/function (_React$Component) {
395
480
  this._label.innerHTML = this.labelContent;
396
481
  this._label.className = this.labelClass;
397
482
  }
483
+
398
484
  for (var i in this.funs) {
399
485
  this.removeListener(i);
400
486
  this.addListener(i, this.funs[i]);
401
487
  }
402
- };
403
- //计算位置, onAdd和缩放和平移之后调用
488
+ }; //计算位置, onAdd和缩放和平移之后调用
489
+
490
+
404
491
  MyLabel.prototype.draw = function () {
405
492
  //返回MapCanvasProjection对象,拥有计算pixel和lnglat的方法
406
- var overlayProjection = this.getProjection();
407
- //将地理坐标转换成屏幕坐标
493
+ var overlayProjection = this.getProjection(); //将地理坐标转换成屏幕坐标
494
+
408
495
  var position = overlayProjection.fromLatLngToDivPixel(this.lnglat);
496
+
409
497
  if (position) {
410
498
  this._label.style.left = position.x + parseFloat(this.labelOffset.x) + 'px';
411
499
  this._label.style.top = position.y + parseFloat(this.labelOffset.y) + 'px';
412
500
  }
413
- };
414
- //更新点位信息
501
+ }; //更新点位信息
502
+
503
+
415
504
  MyLabel.prototype.setOptions = function (options) {
416
505
  this.labelClass = options.labelClass;
417
506
  this.labelContent = options.labelContent;
@@ -420,52 +509,64 @@ var Map = /*#__PURE__*/function (_React$Component) {
420
509
  y: 0
421
510
  };
422
511
  this.lnglat = options.lnglat || this.lnglat;
512
+
423
513
  if (this._label) {
424
514
  this.onAdd();
425
515
  }
426
- };
427
- //更新点位信息
516
+ }; //更新点位信息
517
+
518
+
428
519
  MyLabel.prototype.setPosition = function (lnglat) {
429
520
  this.lnglat = lnglat;
521
+
430
522
  if (this._label) {
431
523
  this.draw();
432
524
  } else {
433
525
  //触发onAdd draw
434
526
  this.setMap(map);
435
527
  }
436
- };
437
- //更新点位信息
528
+ }; //更新点位信息
529
+
530
+
438
531
  MyLabel.prototype.getPosition = function () {
439
532
  return this.lnglat;
440
- };
441
- //更新点位信息
533
+ }; //更新点位信息
534
+
535
+
442
536
  MyLabel.prototype.setZIndex = function (index) {
443
537
  if (this._label) {
444
538
  this._label.style.ZIndex = index;
445
539
  }
446
- };
447
- //用于updatePoint时 判断原来的点图元类型
540
+ }; //用于updatePoint时 判断原来的点图元类型
541
+
542
+
448
543
  MyLabel.prototype.isMarkerContent = function () {
449
544
  return true;
450
- };
451
- //被删除时会调用
545
+ }; //被删除时会调用
546
+
547
+
452
548
  MyLabel.prototype.onRemove = function () {
453
549
  this._label.parentNode.removeChild(this._label);
550
+
454
551
  this._label = null;
455
552
  };
553
+
456
554
  MyLabel.prototype.addListener = function (key, fun) {
457
555
  var tt = this;
556
+
458
557
  if (key == 'dragend') {
459
558
  //编辑返回函数
460
559
  this.dragendFun = fun;
461
560
  return false;
462
561
  }
562
+
463
563
  setTimeout(function () {
464
564
  if (tt._label) {
465
565
  tt.funs[key] = function (event) {
466
566
  if (event.stopPropagation) {
467
567
  event.stopPropagation();
468
568
  }
569
+
469
570
  if (!tt.editable) {
470
571
  fun({
471
572
  latLng: tt.lnglat,
@@ -474,103 +575,124 @@ var Map = /*#__PURE__*/function (_React$Component) {
474
575
  });
475
576
  }
476
577
  };
578
+
477
579
  tt._label.addEventListener(key, tt.funs[key]);
478
580
  } else {
479
581
  tt.addListener(key, fun);
480
582
  }
481
583
  }, 50);
482
584
  };
585
+
483
586
  MyLabel.prototype.removeListener = function (key) {
484
587
  if (key == 'dragend') {
485
588
  this.dragendFun = function () {};
589
+
486
590
  return false;
487
591
  }
592
+
488
593
  if (this._label) {
489
594
  this._label.removeEventListener(key, this.funs[key]);
490
595
  }
491
- };
492
- //设置是否可以编辑
596
+ }; //设置是否可以编辑
597
+
598
+
493
599
  MyLabel.prototype.setDraggable = function (_boolean) {
494
600
  this.editable = _boolean;
601
+
495
602
  if (_boolean) {
496
603
  this.edit();
497
604
  } else {
498
605
  this._label.removeEventListener('mousedown', this.mdown);
499
606
  }
500
- };
501
- //编辑时 事件和逻辑
607
+ }; //编辑时 事件和逻辑
608
+
609
+
502
610
  MyLabel.prototype.edit = function () {
503
611
  var tt = this;
612
+
504
613
  tt.mdown = function (event) {
505
- event.stopPropagation();
506
- //禁止文本选中
507
- tt._label.className = 'noselect';
508
- // 记录原始位置
614
+ event.stopPropagation(); //禁止文本选中
615
+
616
+ tt._label.className = 'noselect'; // 记录原始位置
617
+
509
618
  tt.editParam.sx = event.clientX;
510
619
  tt.editParam.sy = event.clientY;
620
+
511
621
  var mmEvent = function mmEvent(e) {
512
- e.stopPropagation();
513
- //计算与上一次的差值 累加到label dom上
622
+ e.stopPropagation(); //计算与上一次的差值 累加到label dom上
623
+
514
624
  tt._label.style.left = parseFloat(tt._label.style.left.replace('px', '')) + e.clientX - tt.editParam.sx + 'px';
515
- tt._label.style.top = parseFloat(tt._label.style.top.replace('px', '')) + e.clientY - tt.editParam.sy + 'px';
516
- //更新原始位置
625
+ tt._label.style.top = parseFloat(tt._label.style.top.replace('px', '')) + e.clientY - tt.editParam.sy + 'px'; //更新原始位置
626
+
517
627
  tt.editParam.sx = e.clientX;
518
628
  tt.editParam.sy = e.clientY;
519
629
  };
630
+
520
631
  var mupEvent = function mupEvent(e) {
521
- e.stopPropagation();
522
- //计算与上一次的差值 累加到label dom上
632
+ e.stopPropagation(); //计算与上一次的差值 累加到label dom上
633
+
523
634
  var x = parseFloat(tt._label.style.left.replace('px', '')) + e.clientX - tt.editParam.sx,
524
- y = parseFloat(tt._label.style.top.replace('px', '')) + e.clientY - tt.editParam.sy;
525
- //计算经纬度,固定label的位置
635
+ y = parseFloat(tt._label.style.top.replace('px', '')) + e.clientY - tt.editParam.sy; //计算经纬度,固定label的位置
636
+
526
637
  tt._label.style.left = x + 'px';
527
638
  tt._label.style.top = y + 'px';
528
639
  var overlayProjection = tt.getProjection(),
529
- latlng = overlayProjection.fromDivPixelToLatLng(new google.maps.Point(x, y));
530
- tt.setPosition(latlng);
531
- // 清空 文本禁选
640
+ latlng = overlayProjection.fromDivPixelToLatLng(new google.maps.Point(x, y));
641
+ tt.setPosition(latlng); // 清空 文本禁选
642
+
532
643
  tt._label.className = '';
533
- tt.dragendFun(e);
534
- //关闭全局监听
644
+ tt.dragendFun(e); //关闭全局监听
645
+
535
646
  document.removeEventListener('mousemove', mmEvent);
536
647
  document.removeEventListener('mouseup', mupEvent);
537
648
  };
649
+
538
650
  document.addEventListener('mousemove', mmEvent);
539
651
  document.addEventListener('mouseup', mupEvent);
540
652
  };
653
+
541
654
  tt._label.addEventListener('mousedown', tt.mdown);
542
655
  };
543
656
  /*=================================end========================================*/
544
- }
545
- //设置指定图元展示 google只有zoom和center全适应,单适应暂时无法实现
657
+
658
+ } //设置指定图元展示 google只有zoom和center全适应,单适应暂时无法实现
659
+
546
660
  }, {
547
661
  key: "setVisiblePoints",
548
662
  value: function setVisiblePoints(obj) {
549
663
  var t = this;
550
664
  var ls = [];
551
665
  var _t$state = t.state,
552
- pointIds = _t$state.pointIds,
553
- lineIds = _t$state.lineIds,
554
- polygonIds = _t$state.polygonIds,
555
- circleIds = _t$state.circleIds;
666
+ pointIds = _t$state.pointIds,
667
+ lineIds = _t$state.lineIds,
668
+ polygonIds = _t$state.polygonIds,
669
+ circleIds = _t$state.circleIds;
670
+
556
671
  var getLngLats = function getLngLats(ids, type) {
557
672
  var alnglat = [],
558
- lngs = [],
559
- lats = [];
673
+ lngs = [],
674
+ lats = [];
675
+
560
676
  if (!type) {
561
677
  t.GM.getMoreGraphicParam(ids).map(function (item, index) {
562
678
  var _alnglat, _alnglat2;
679
+
563
680
  //根据天地图 覆盖物类型获取lnglat
564
681
  switch (item.geometryType) {
565
682
  case 'point':
566
683
  alnglat.push([item.geometry.x, item.geometry.y]);
567
684
  break;
685
+
568
686
  case 'polyline':
569
687
  (_alnglat = alnglat).push.apply(_alnglat, _toConsumableArray(item.geometry.paths));
688
+
570
689
  break;
690
+
571
691
  case 'polygon':
572
692
  (_alnglat2 = alnglat).push.apply(_alnglat2, _toConsumableArray(item.geometry.rings));
693
+
573
694
  break;
695
+
574
696
  case 'circle':
575
697
  alnglat.push([item.geometry.x, item.geometry.y]);
576
698
  break;
@@ -579,6 +701,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
579
701
  } else {
580
702
  alnglat = ids;
581
703
  }
704
+
582
705
  alnglat.forEach(function (item, index) {
583
706
  lngs.push(item[0]);
584
707
  lats.push(item[1]);
@@ -595,59 +718,74 @@ var Map = /*#__PURE__*/function (_React$Component) {
595
718
  lat: lats[lats.length - 1]
596
719
  })
597
720
  };
598
- };
599
- //算出 要展示的图元点位
721
+ }; //算出 要展示的图元点位
722
+
723
+
600
724
  switch (obj.fitView) {
601
725
  case 'point':
602
726
  ls = getLngLats(pointIds);
603
727
  break;
728
+
604
729
  case 'line':
605
730
  ls = getLngLats(lineIds);
606
731
  break;
732
+
607
733
  case 'polygon':
608
734
  ls = getLngLats(polygonIds);
609
735
  break;
736
+
610
737
  case 'circle':
611
738
  ls = getLngLats(circleIds);
612
739
  break;
740
+
613
741
  case 'all':
614
742
  ls = getLngLats([].concat(_toConsumableArray(pointIds), _toConsumableArray(lineIds), _toConsumableArray(polygonIds), _toConsumableArray(circleIds)));
615
743
  break;
744
+
616
745
  default:
617
746
  var ids = [];
747
+
618
748
  if (obj.fitView instanceof Array) {
619
749
  ids = obj.fitView;
620
750
  } else if (typeof obj.fitView === 'string') {
621
751
  ids = obj.fitView.split(',');
622
- }
623
- //支持传经纬度
752
+ } //支持传经纬度
753
+
754
+
624
755
  if (ids[0] instanceof Array) {
625
756
  ls = getLngLats(ids, 'lnglat');
626
757
  } else {
627
758
  ls = getLngLats(ids);
628
759
  }
760
+
629
761
  break;
630
762
  }
763
+
631
764
  t.state.gis.fitBounds(new google.maps.LatLngBounds(ls.sw, ls.ne));
632
- }
633
- //设置地图中心位置 lng/经度 lat/纬度
765
+ } //设置地图中心位置 lng/经度 lat/纬度
766
+
634
767
  }, {
635
768
  key: "setCenter",
636
769
  value: function setCenter(gt) {
637
770
  var t = this;
638
771
  var mgt = [626.3002300508477, 37.90942995363547];
772
+
639
773
  if (gt) {
640
774
  //经纬度 必须存在 否则不操作
641
775
  if (!gt[0] || !gt[1]) {
642
776
  return false;
643
- }
644
- //如果设置的经纬度 与当前中心点一样 不操作
777
+ } //如果设置的经纬度 与当前中心点一样 不操作
778
+
779
+
645
780
  var c = t.state.gis.getCenter();
781
+
646
782
  if (c.lng == gt[0] && c.lat == gt[1]) {
647
783
  return false;
648
784
  }
785
+
649
786
  mgt = gt;
650
787
  }
788
+
651
789
  t.state.gis.setCenter(new google.maps.LatLng({
652
790
  lng: mgt[0],
653
791
  lat: mgt[1]
@@ -655,42 +793,47 @@ var Map = /*#__PURE__*/function (_React$Component) {
655
793
  t.setState({
656
794
  center: mgt
657
795
  });
658
- }
659
- //设置地图比例尺
796
+ } //设置地图比例尺
797
+
660
798
  }, {
661
799
  key: "setZoomLevel",
662
800
  value: function setZoomLevel(zoom) {
663
801
  var t = this;
664
802
  var z = t.getZoomLevel();
803
+
665
804
  if (z == zoom) {
666
805
  return false;
667
806
  }
807
+
668
808
  t.state.gis.setZoom(zoom);
669
- }
670
- //清空地图所有图元
809
+ } //清空地图所有图元
810
+
671
811
  }, {
672
812
  key: "clearAll",
673
813
  value: function clearAll() {
674
- var t = this;
675
- //清空热力图
814
+ var t = this; //清空热力图
815
+
676
816
  if (t.heatmap) {
677
817
  t.heatmap.setMap(null);
678
818
  }
679
- t.heatmap = null;
680
- //先清除所有标记
819
+
820
+ t.heatmap = null; //先清除所有标记
821
+
681
822
  if (t.clusterIdList.length) {
682
823
  t.clearClusters();
683
824
  }
684
- t.clearAllPointCollection();
685
- //清空点
825
+
826
+ t.clearAllPointCollection(); //清空点
827
+
686
828
  for (var i in t.GM.allGraphics) {
687
829
  if (t.GM.allGraphics[i]) {
688
830
  t.GM.allGraphics[i].setMap(null);
689
831
  }
690
- }
691
- //清空缓存数据
692
- t.GM.clearAll();
693
- //清空历史数据记录
832
+ } //清空缓存数据
833
+
834
+
835
+ t.GM.clearAll(); //清空历史数据记录
836
+
694
837
  t.setState({
695
838
  pointIds: [],
696
839
  lineIds: [],
@@ -705,27 +848,32 @@ var Map = /*#__PURE__*/function (_React$Component) {
705
848
  rectangle: []
706
849
  }
707
850
  });
708
- }
709
- //图元功能处理方法
851
+ } //图元功能处理方法
710
852
  //新增点位
853
+
711
854
  }, {
712
855
  key: "addPoint",
713
856
  value: function addPoint(mapPoints, type) {
714
857
  var _this2 = this;
858
+
715
859
  var t = this;
860
+
716
861
  var psids = _toConsumableArray(t.state.pointIds);
862
+
717
863
  var apf = function apf() {
718
864
  mapPoints.map(function (item, index) {
719
865
  //如果id重复,直接跳过不执行.
720
866
  if (_this2.GM.isRepetition(item.id)) {
721
867
  console.warn("\u52A0\u70B9id: ".concat(item.id, " \u91CD\u590D"));
722
868
  return false;
723
- }
724
- //点位数据不符合,直接跳过
869
+ } //点位数据不符合,直接跳过
870
+
871
+
725
872
  if (!item.longitude || !item.latitude) {
726
873
  console.warn("\u70B9 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
727
874
  return false;
728
875
  }
876
+
729
877
  var cg = {
730
878
  width: 30,
731
879
  height: 30,
@@ -739,6 +887,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
739
887
  markerContentY: -30,
740
888
  deg: 0
741
889
  };
890
+
742
891
  if (item.markerContent) {
743
892
  cg = _objectSpread(_objectSpread({}, cg), {}, {
744
893
  markerContentX: 0,
@@ -746,16 +895,19 @@ var Map = /*#__PURE__*/function (_React$Component) {
746
895
  width: 100,
747
896
  height: 30
748
897
  });
749
- }
750
- //初始化默认数据
898
+ } //初始化默认数据
899
+
900
+
751
901
  if (item.config) {
752
902
  cg = _objectSpread(_objectSpread({}, cg), item.config);
753
903
  }
904
+
754
905
  var position = new t.omap.LatLng({
755
906
  lng: item.longitude,
756
907
  lat: item.latitude
757
908
  });
758
909
  var marker = null;
910
+
759
911
  if (item.markerContent) {
760
912
  /*自定义html加点
761
913
  用Label来实现,无法再添加label(高德有判断,实现不同)*/
@@ -773,15 +925,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
773
925
  // //添加label
774
926
  if (item.canShowLabel && cg.labelContent) {
775
927
  //label默认样式
776
- var labelClass = 'label-content';
777
- //接受label自定义样式
928
+ var labelClass = 'label-content'; //接受label自定义样式
929
+
778
930
  if (item.labelClass) {
779
931
  labelClass = item.labelClass.split(',').join(' ');
780
932
  }
933
+
781
934
  var label = new t.MyLabel(t.state.gis, {
782
935
  isLabel: true,
783
936
  labelClass: labelClass,
784
937
  labelContent: cg.labelContent,
938
+
785
939
  /*
786
940
  为和百度等地图相同的参数 加上g.markerContentY值
787
941
  label是使用OverlayView手动实现,与marker没有关联的原因
@@ -791,12 +945,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
791
945
  y: cg.labelPixelY + cg.markerContentY
792
946
  }
793
947
  });
794
- label.setPosition(position);
795
- //缓存
948
+ label.setPosition(position); //缓存
949
+
796
950
  t.GM.setGraphic("".concat(item.id, "_vtxoMap_label"), label);
797
951
  }
798
- var iconUrl = '';
799
- // 360deg 不需要旋转
952
+
953
+ var iconUrl = ''; // 360deg 不需要旋转
954
+
800
955
  if (parseFloat(cg.deg) % 360 != 0) {
801
956
  iconUrl = new _MapToolFunction.RotateIcon({
802
957
  url: item.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
@@ -804,6 +959,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
804
959
  height: cg.height
805
960
  });
806
961
  }
962
+
807
963
  var icon = {
808
964
  anchor: {
809
965
  x: -cg.markerContentX,
@@ -816,26 +972,30 @@ var Map = /*#__PURE__*/function (_React$Component) {
816
972
  x: cg.labelPixelX,
817
973
  y: cg.labelPixelY
818
974
  }
819
- };
820
- //添加点到地图
975
+ }; //添加点到地图
976
+
821
977
  marker = new t.omap.Marker({
822
978
  icon: icon,
823
979
  position: position,
824
980
  map: t.state.gis
825
981
  });
982
+
826
983
  if (item.canShowLabel && cg.labelContent) {
827
984
  marker.ishaveLabel = true;
828
985
  }
829
986
  }
987
+
830
988
  if (cg.zIndex || cg.zIndex === 0) {
831
989
  marker.setZIndex(cg.zIndex);
832
990
  }
991
+
833
992
  if (!item.markerContent && cg.BAnimationType == 0) {
834
993
  marker.setAnimation(google.maps.Animation.BOUNCE);
835
994
  } else if (!item.markerContent && cg.BAnimationType == 1) {
836
995
  marker.setAnimation(google.maps.Animation.DROP);
837
- }
838
- //点击事件
996
+ } //点击事件
997
+
998
+
839
999
  var mClick = marker.addListener('click', function (e) {
840
1000
  //避免鼠标在图元上 测距工具不起作用
841
1001
  if (t.rangingTool.isRanging) {
@@ -843,18 +1003,18 @@ var Map = /*#__PURE__*/function (_React$Component) {
843
1003
  } else {
844
1004
  t.clickGraphic(item.id, e);
845
1005
  }
846
- });
847
- //鼠标移入事件
1006
+ }); //鼠标移入事件
1007
+
848
1008
  var mMouseover = marker.addListener('mouseover', function (e) {
849
1009
  t.mouseOverGraphic(item.id, e);
850
- });
851
- //鼠标移出事件
1010
+ }); //鼠标移出事件
1011
+
852
1012
  var mMouseout = marker.addListener('mouseout', function (e) {
853
1013
  t.mouseOutGraphic(item.id, e);
854
- });
855
- //缓存所有点的id
856
- psids.push(item.id);
857
- //缓存当前点的图元对象和基本数据
1014
+ }); //缓存所有点的id
1015
+
1016
+ psids.push(item.id); //缓存当前点的图元对象和基本数据
1017
+
858
1018
  t.GM.setGraphic(item.id, marker).setGraphicParam(item.id, {
859
1019
  attributes: _objectSpread(_objectSpread({}, item), {}, {
860
1020
  other: item
@@ -871,15 +1031,16 @@ var Map = /*#__PURE__*/function (_React$Component) {
871
1031
  mouseout: mMouseout
872
1032
  });
873
1033
  });
1034
+
874
1035
  if (type !== 'defined') {
875
1036
  //所有点缓存在state中
876
- t.state.pointIds = psids;
877
- // t.setState({
1037
+ t.state.pointIds = psids; // t.setState({
878
1038
  // pointIds: psids
879
1039
  // });
880
1040
  }
881
- };
882
- //内部 不需要旋转图标的处理方式
1041
+ }; //内部 不需要旋转图标的处理方式
1042
+
1043
+
883
1044
  if (type == 'nodeg') {
884
1045
  apf();
885
1046
  } else {
@@ -892,19 +1053,21 @@ var Map = /*#__PURE__*/function (_React$Component) {
892
1053
  t.cacheImg.appendChild(i);
893
1054
  t.cacheImgRecord[item.url] = true;
894
1055
  }
895
- });
896
- //定时等待 图片缓存,点位旋转功能需要
1056
+ }); //定时等待 图片缓存,点位旋转功能需要
1057
+
897
1058
  t.addPsTimer = setTimeout(function () {
898
1059
  apf();
899
1060
  }, 200);
900
1061
  }
901
- }
902
- //更新点位
1062
+ } //更新点位
1063
+
903
1064
  }, {
904
1065
  key: "updatePoint",
905
1066
  value: function updatePoint(mapPoints, type) {
906
1067
  var _this3 = this;
1068
+
907
1069
  var t = this;
1070
+
908
1071
  var upf = function upf() {
909
1072
  mapPoints.map(function (item, index) {
910
1073
  //判断图元是否存在.
@@ -913,17 +1076,20 @@ var Map = /*#__PURE__*/function (_React$Component) {
913
1076
  if (!item.longitude || !item.latitude) {
914
1077
  console.warn("\u70B9 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
915
1078
  return false;
916
- }
917
- //获取原有的图元 和 对应的label
1079
+ } //获取原有的图元 和 对应的label
1080
+
1081
+
918
1082
  var gc = t.GM.getGraphic(item.id),
919
- gc_label = t.GM.getGraphic("".concat(item.id, "_vtxoMap_label"));
920
- //更新前删除聚合
1083
+ gc_label = t.GM.getGraphic("".concat(item.id, "_vtxoMap_label")); //更新前删除聚合
1084
+
921
1085
  if (t.clusterIdList.indexOf(item.id) > -1) {
922
1086
  t._cluster.removeMarker(gc);
1087
+
923
1088
  if (gc_label) {
924
1089
  t._cluster.removeMarker(gc_label);
925
1090
  }
926
1091
  }
1092
+
927
1093
  var cg = {
928
1094
  width: 30,
929
1095
  height: 30,
@@ -937,6 +1103,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
937
1103
  markerContentY: -30,
938
1104
  deg: 0
939
1105
  };
1106
+
940
1107
  if (item.markerContent) {
941
1108
  cg = _objectSpread(_objectSpread({}, cg), {}, {
942
1109
  markerContentX: 0,
@@ -945,16 +1112,18 @@ var Map = /*#__PURE__*/function (_React$Component) {
945
1112
  height: 30
946
1113
  });
947
1114
  }
1115
+
948
1116
  if (item.config) {
949
1117
  cg = _objectSpread(_objectSpread({}, cg), item.config);
950
- }
951
- //新旧经纬度 旧经纬度配合moveTo使用
1118
+ } //新旧经纬度 旧经纬度配合moveTo使用
1119
+
1120
+
952
1121
  var position = new t.omap.LatLng({
953
1122
  lng: item.longitude,
954
1123
  lat: item.latitude
955
1124
  });
956
- var oldPosition = gc.getPosition();
957
- //前后点位类型都是markerContent
1125
+ var oldPosition = gc.getPosition(); //前后点位类型都是markerContent
1126
+
958
1127
  if (gc.isMarkerContent && gc.isMarkerContent() && item.markerContent) {
959
1128
  /*
960
1129
  自定义html加点
@@ -974,11 +1143,11 @@ var Map = /*#__PURE__*/function (_React$Component) {
974
1143
  //清除事件
975
1144
  gc.removeListener('click');
976
1145
  gc.removeListener('mouseover');
977
- gc.removeListener('mouseout');
978
- //删除原点位
1146
+ gc.removeListener('mouseout'); //删除原点位
1147
+
979
1148
  gc.setMap(null);
980
- var iconUrl = '';
981
- // 360deg 不需要旋转
1149
+ var iconUrl = ''; // 360deg 不需要旋转
1150
+
982
1151
  if (parseFloat(cg.deg) % 360 != 0) {
983
1152
  iconUrl = new _MapToolFunction.RotateIcon({
984
1153
  url: item.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
@@ -986,6 +1155,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
986
1155
  height: cg.height
987
1156
  });
988
1157
  }
1158
+
989
1159
  var icon = {
990
1160
  anchor: {
991
1161
  x: -cg.markerContentX,
@@ -998,29 +1168,33 @@ var Map = /*#__PURE__*/function (_React$Component) {
998
1168
  x: cg.labelPixelX,
999
1169
  y: cg.labelPixelY
1000
1170
  }
1001
- };
1002
- //重新加载点位
1171
+ }; //重新加载点位
1172
+
1003
1173
  gc = new t.omap.Marker({
1004
1174
  icon: icon,
1005
1175
  position: oldPosition,
1006
1176
  map: t.state.gis
1007
- });
1008
- //切换 图元对象缓存
1177
+ }); //切换 图元对象缓存
1178
+
1009
1179
  t.GM.setGraphic(item.id, gc);
1180
+
1010
1181
  if (item.canShowLabel && cg.labelContent) {
1011
1182
  //label默认样式
1012
- var labelClass = 'label-content';
1013
- //接受label自定义样式
1183
+ var labelClass = 'label-content'; //接受label自定义样式
1184
+
1014
1185
  if (item.labelClass) {
1015
1186
  labelClass = item.labelClass.split(',').join(' ');
1016
1187
  }
1188
+
1017
1189
  if (!gc_label) {
1018
1190
  gc_label = new t.MyLabel();
1019
1191
  t.GM.setGraphic("".concat(item.id, "_vtxoMap_label"), gc_label);
1020
1192
  }
1193
+
1021
1194
  gc_label.setOptions({
1022
1195
  labelClass: labelClass,
1023
1196
  labelContent: cg.labelContent,
1197
+
1024
1198
  /*
1025
1199
  为和百度等地图相同的参数 加上g.markerContentY值
1026
1200
  label是使用OverlayView手动实现,与marker没有关联的原因
@@ -1031,8 +1205,9 @@ var Map = /*#__PURE__*/function (_React$Component) {
1031
1205
  }
1032
1206
  });
1033
1207
  gc.ishaveLabel = true;
1034
- }
1035
- //点击事件
1208
+ } //点击事件
1209
+
1210
+
1036
1211
  var mClick = gc.addListener('click', function (e) {
1037
1212
  //避免鼠标在图元上 测距工具不起作用
1038
1213
  if (t.rangingTool.isRanging) {
@@ -1040,12 +1215,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
1040
1215
  } else {
1041
1216
  t.clickGraphic(item.id, e);
1042
1217
  }
1043
- });
1044
- //鼠标移入事件
1218
+ }); //鼠标移入事件
1219
+
1045
1220
  var mMouseover = gc.addListener('mouseover', function (e) {
1046
1221
  t.mouseOverGraphic(item.id, e);
1047
- });
1048
- //鼠标移出事件
1222
+ }); //鼠标移出事件
1223
+
1049
1224
  var mMouseout = gc.addListener('mouseout', function (e) {
1050
1225
  t.mouseOutGraphic(item.id, e);
1051
1226
  });
@@ -1060,20 +1235,24 @@ var Map = /*#__PURE__*/function (_React$Component) {
1060
1235
  if (t.GM.getGraphicParam("".concat(item.id, "_omap_event")).click) {
1061
1236
  t.GM.getGraphicParam("".concat(item.id, "_omap_event")).click.remove();
1062
1237
  }
1238
+
1063
1239
  if (t.GM.getGraphicParam("".concat(item.id, "_omap_event")).mouseover) {
1064
1240
  t.GM.getGraphicParam("".concat(item.id, "_omap_event")).mouseover.remove();
1065
1241
  }
1242
+
1066
1243
  if (t.GM.getGraphicParam("".concat(item.id, "_omap_event")).mouseout) {
1067
1244
  t.GM.getGraphicParam("".concat(item.id, "_omap_event")).mouseout.remove();
1068
- }
1069
- //删除原点位
1070
- gc.setMap(null);
1071
- //存在 label点位 直接删除
1245
+ } //删除原点位
1246
+
1247
+
1248
+ gc.setMap(null); //存在 label点位 直接删除
1249
+
1072
1250
  if (gc_label) {
1073
1251
  gc_label.setMap(null);
1074
1252
  t.GM.removeGraphic("".concat(item.id, "_vtxoMap_label"));
1075
- }
1076
- //重新加载点位 (原有位置加载,配合moveTo方法使用)
1253
+ } //重新加载点位 (原有位置加载,配合moveTo方法使用)
1254
+
1255
+
1077
1256
  gc = new t.MyLabel(t.state.gis, {
1078
1257
  labelContent: item.markerContent,
1079
1258
  labelOffset: {
@@ -1081,10 +1260,10 @@ var Map = /*#__PURE__*/function (_React$Component) {
1081
1260
  y: cg.markerContentY
1082
1261
  }
1083
1262
  });
1084
- gc.setPosition(oldPosition);
1085
- //切换 图元对象缓存
1086
- t.GM.setGraphic(item.id, gc);
1087
- //点击事件
1263
+ gc.setPosition(oldPosition); //切换 图元对象缓存
1264
+
1265
+ t.GM.setGraphic(item.id, gc); //点击事件
1266
+
1088
1267
  var _mClick = gc.addListener('click', function (e) {
1089
1268
  //避免鼠标在图元上 测距工具不起作用
1090
1269
  if (t.rangingTool.isRanging) {
@@ -1092,31 +1271,35 @@ var Map = /*#__PURE__*/function (_React$Component) {
1092
1271
  } else {
1093
1272
  t.clickGraphic(item.id, e);
1094
1273
  }
1095
- });
1096
- //鼠标移入事件
1274
+ }); //鼠标移入事件
1275
+
1276
+
1097
1277
  var _mMouseover = gc.addListener('mouseover', function (e) {
1098
1278
  t.mouseOverGraphic(item.id, e);
1099
- });
1100
- //鼠标移出事件
1279
+ }); //鼠标移出事件
1280
+
1281
+
1101
1282
  var _mMouseout = gc.addListener('mouseout', function (e) {
1102
1283
  t.mouseOutGraphic(item.id, e);
1103
1284
  });
1285
+
1104
1286
  t.GM.setGraphicParam("".concat(item.id, "_omap_event"), {
1105
1287
  click: _mClick,
1106
1288
  mouseover: _mMouseover,
1107
1289
  mouseout: _mMouseout
1108
1290
  });
1109
1291
  } else {
1110
- var _iconUrl = '';
1111
- // 360deg 不需要旋转
1292
+ var _iconUrl = ''; // 360deg 不需要旋转
1293
+
1112
1294
  if (parseFloat(cg.deg) % 360 != 0) {
1113
1295
  _iconUrl = new _MapToolFunction.RotateIcon({
1114
1296
  url: item.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png"),
1115
1297
  width: cg.width,
1116
1298
  height: cg.height
1117
1299
  });
1118
- }
1119
- //前后点位类型都是marker-url
1300
+ } //前后点位类型都是marker-url
1301
+
1302
+
1120
1303
  var _icon = {
1121
1304
  anchor: {
1122
1305
  x: -cg.markerContentX,
@@ -1131,20 +1314,24 @@ var Map = /*#__PURE__*/function (_React$Component) {
1131
1314
  }
1132
1315
  };
1133
1316
  gc.setIcon(_icon);
1317
+
1134
1318
  if (item.canShowLabel && cg.labelContent) {
1135
1319
  //label默认样式
1136
- var _labelClass = 'label-content';
1137
- //接受label自定义样式
1320
+ var _labelClass = 'label-content'; //接受label自定义样式
1321
+
1138
1322
  if (item.labelClass) {
1139
1323
  _labelClass = item.labelClass.split(',').join(' ');
1140
1324
  }
1325
+
1141
1326
  if (!gc_label) {
1142
1327
  gc_label = new t.MyLabel();
1143
1328
  t.GM.setGraphic("".concat(item.id, "_vtxoMap_label"), gc_label);
1144
1329
  }
1330
+
1145
1331
  gc_label.setOptions({
1146
1332
  labelClass: _labelClass,
1147
1333
  labelContent: cg.labelContent,
1334
+
1148
1335
  /*
1149
1336
  为和百度等地图相同的参数 加上g.markerContentY值
1150
1337
  label是使用OverlayView手动实现,与marker没有关联的原因
@@ -1157,6 +1344,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
1157
1344
  gc.ishaveLabel = true;
1158
1345
  }
1159
1346
  }
1347
+
1160
1348
  if (!item.markerContent && cg.BAnimationType == 0) {
1161
1349
  gc.setAnimation(google.maps.Animation.BOUNCE);
1162
1350
  } else if (!item.markerContent && cg.BAnimationType == 1) {
@@ -1164,18 +1352,23 @@ var Map = /*#__PURE__*/function (_React$Component) {
1164
1352
  }
1165
1353
  /*moveTo*/
1166
1354
  //动画效果会延迟执行经纬度的切换
1355
+
1356
+
1167
1357
  if (cg.isAnimation) {
1168
1358
  t.moveTo(item.id, [item.longitude, item.latitude], cg.animationDelay, cg.autoRotation, item.url, item.urlleft);
1169
1359
  } else {
1170
1360
  if (gc_label) {
1171
1361
  gc_label.setPosition(position);
1172
- }
1173
- //修改经纬度
1362
+ } //修改经纬度
1363
+
1364
+
1174
1365
  gc.setPosition(position);
1175
1366
  }
1367
+
1176
1368
  if (cg.zIndex || cg.zIndex === 0) {
1177
1369
  gc.setZIndex(cg.zIndex);
1178
1370
  }
1371
+
1179
1372
  t.GM.setGraphicParam(item.id, {
1180
1373
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1181
1374
  other: item
@@ -1193,8 +1386,9 @@ var Map = /*#__PURE__*/function (_React$Component) {
1193
1386
  }
1194
1387
  });
1195
1388
  t.moveAnimation();
1196
- };
1197
- //内部 不需要旋转图标的处理方式
1389
+ }; //内部 不需要旋转图标的处理方式
1390
+
1391
+
1198
1392
  if (type == 'nodeg') {
1199
1393
  upf();
1200
1394
  } else {
@@ -1207,51 +1401,59 @@ var Map = /*#__PURE__*/function (_React$Component) {
1207
1401
  t.cacheImg.appendChild(i);
1208
1402
  t.cacheImgRecord[item.url] = true;
1209
1403
  }
1404
+
1210
1405
  if (item.urlleft && !t.cacheImgRecord[item.urlleft]) {
1211
1406
  var _i = new Image();
1407
+
1212
1408
  _i.src = item.urlleft;
1213
1409
  t.cacheImg.appendChild(_i);
1214
1410
  t.cacheImgRecord[item.urlleft] = true;
1215
1411
  }
1216
- });
1217
- // 定时等待 图片缓存,点位旋转功能需要
1412
+ }); // 定时等待 图片缓存,点位旋转功能需要
1413
+
1218
1414
  t.upPsTimer = setTimeout(function () {
1219
1415
  upf();
1220
1416
  }, 200);
1221
1417
  }
1222
- }
1223
- //添加线
1418
+ } //添加线
1419
+
1224
1420
  }, {
1225
1421
  key: "addLine",
1226
1422
  value: function addLine(mapLines, type) {
1227
1423
  var t = this;
1228
- var lsids = _toConsumableArray(t.state.lineIds);
1229
- //遍历添加线(图元)
1424
+
1425
+ var lsids = _toConsumableArray(t.state.lineIds); //遍历添加线(图元)
1426
+
1427
+
1230
1428
  mapLines.map(function (item, index) {
1231
1429
  //如果id重复,直接跳过不执行.
1232
1430
  if (t.GM.isRepetition(item.id)) {
1233
1431
  console.warn("\u591A\u6298\u7EBFid: ".concat(item.id, " \u91CD\u590D"));
1234
1432
  return false;
1235
- }
1236
- //多折线点位数据不符合,直接跳过
1433
+ } //多折线点位数据不符合,直接跳过
1434
+
1435
+
1237
1436
  if (!(item.paths && item.paths.length >= 2)) {
1238
1437
  console.warn("\u591A\u6298\u7EBFpaths\u6570\u636E\u9519\u8BEF");
1239
1438
  return false;
1240
- }
1241
- //初始化默认参数
1439
+ } //初始化默认参数
1440
+
1441
+
1242
1442
  var cg = {
1243
1443
  color: '#277ffa',
1244
1444
  pellucidity: 0.9,
1245
1445
  lineWidth: 5,
1246
1446
  lineType: 'solid',
1247
1447
  isHidden: false
1248
- };
1249
- //合并参数
1448
+ }; //合并参数
1449
+
1250
1450
  if (item.config) {
1251
1451
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1252
- }
1253
- // 线样式
1452
+ } // 线样式
1453
+
1454
+
1254
1455
  var icons = [];
1456
+
1255
1457
  if (cg.lineType == 'dashed') {
1256
1458
  var lineSymbol = {
1257
1459
  path: 'M 0,-1 0,1',
@@ -1263,38 +1465,40 @@ var Map = /*#__PURE__*/function (_React$Component) {
1263
1465
  offset: '0',
1264
1466
  repeat: '20px'
1265
1467
  }];
1266
- }
1267
- //处理线的点数组
1468
+ } //处理线的点数组
1469
+
1470
+
1268
1471
  var linePath = item.paths.map(function (item, index) {
1269
- return new google.maps.LatLng({
1270
- lng: item[0],
1271
- lat: item[1]
1272
- });
1273
- }),
1274
- //处理线的参数
1275
- lineOption = {
1276
- strokeColor: cg.color,
1277
- // 线颜色
1278
- strokeWeight: cg.lineWidth,
1279
- // 线宽
1280
- strokeOpacity: cg.lineType == 'dashed' ? 0 : cg.pellucidity,
1281
- // 线透明度
1282
- icons: icons
1283
- };
1284
- //创建线对象
1472
+ return new google.maps.LatLng({
1473
+ lng: item[0],
1474
+ lat: item[1]
1475
+ });
1476
+ }),
1477
+ //处理线的参数
1478
+ lineOption = {
1479
+ strokeColor: cg.color,
1480
+ // 线颜色
1481
+ strokeWeight: cg.lineWidth,
1482
+ // 线宽
1483
+ strokeOpacity: cg.lineType == 'dashed' ? 0 : cg.pellucidity,
1484
+ // 线透明度
1485
+ icons: icons
1486
+ }; //创建线对象
1487
+
1285
1488
  var line = new google.maps.Polyline(_objectSpread(_objectSpread({}, lineOption), {}, {
1286
1489
  path: linePath
1287
- }));
1288
- //判断线显示和隐藏
1490
+ })); //判断线显示和隐藏
1491
+
1289
1492
  if (cg.isHidden) {
1290
1493
  line.setVisible(false);
1291
1494
  } else {
1292
1495
  line.setVisible(true);
1293
1496
  }
1294
- lsids.push(item.id);
1295
- //添加线至地图
1296
- line.setMap(t.state.gis);
1297
- //点击事件
1497
+
1498
+ lsids.push(item.id); //添加线至地图
1499
+
1500
+ line.setMap(t.state.gis); //点击事件
1501
+
1298
1502
  var mClick = line.addListener('click', function (e) {
1299
1503
  //避免鼠标在图元上 测距工具不起作用
1300
1504
  if (t.rangingTool.isRanging) {
@@ -1302,12 +1506,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
1302
1506
  } else {
1303
1507
  t.clickGraphic(item.id, e);
1304
1508
  }
1305
- });
1306
- //鼠标移入事件
1509
+ }); //鼠标移入事件
1510
+
1307
1511
  var mMouseover = line.addListener('mouseover', function (e) {
1308
1512
  t.mouseOverGraphic(item.id, e);
1309
- });
1310
- //鼠标移出事件
1513
+ }); //鼠标移出事件
1514
+
1311
1515
  var mMouseout = line.addListener('mouseout', function (e) {
1312
1516
  t.mouseOutGraphic(item.id, e);
1313
1517
  });
@@ -1327,19 +1531,19 @@ var Map = /*#__PURE__*/function (_React$Component) {
1327
1531
  mouseout: mMouseout
1328
1532
  });
1329
1533
  });
1534
+
1330
1535
  if (type !== 'defined') {
1331
- t.state.lineIds = lsids;
1332
- // t.setState({
1536
+ t.state.lineIds = lsids; // t.setState({
1333
1537
  // lineIds: lsids
1334
1538
  // });
1335
1539
  }
1336
- }
1337
- //更新线
1540
+ } //更新线
1541
+
1338
1542
  }, {
1339
1543
  key: "updateLine",
1340
1544
  value: function updateLine(mapLines) {
1341
- var t = this;
1342
- //遍历添加线(图元)
1545
+ var t = this; //遍历添加线(图元)
1546
+
1343
1547
  mapLines.map(function (item, index) {
1344
1548
  //判断图元是否存在.
1345
1549
  if (t.GM.isRepetition(item.id)) {
@@ -1352,8 +1556,9 @@ var Map = /*#__PURE__*/function (_React$Component) {
1352
1556
  console.warn("\u66F4\u65B0\u7684\u591A\u6298\u7EBFid\u4E0D\u5B58\u5728!");
1353
1557
  return false;
1354
1558
  }
1355
- var gc = t.GM.getGraphic(item.id);
1356
- //初始化默认参数
1559
+
1560
+ var gc = t.GM.getGraphic(item.id); //初始化默认参数
1561
+
1357
1562
  var cg = {
1358
1563
  color: '#277ffa',
1359
1564
  pellucidity: 0.9,
@@ -1361,13 +1566,15 @@ var Map = /*#__PURE__*/function (_React$Component) {
1361
1566
  lineType: 'solid',
1362
1567
  //'solid' 'dashed'
1363
1568
  isHidden: false
1364
- };
1365
- //合并参数
1569
+ }; //合并参数
1570
+
1366
1571
  if (item.config) {
1367
1572
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1368
- }
1369
- // 线样式
1573
+ } // 线样式
1574
+
1575
+
1370
1576
  var icons = [];
1577
+
1371
1578
  if (cg.lineType == 'dashed') {
1372
1579
  var lineSymbol = {
1373
1580
  path: 'M 0,-1 0,1',
@@ -1379,34 +1586,36 @@ var Map = /*#__PURE__*/function (_React$Component) {
1379
1586
  offset: '0',
1380
1587
  repeat: '20px'
1381
1588
  }];
1382
- }
1383
- //处理线的点数组
1589
+ } //处理线的点数组
1590
+
1591
+
1384
1592
  var linePath = item.paths.map(function (item, index) {
1385
- return new google.maps.LatLng({
1386
- lng: item[0],
1387
- lat: item[1]
1388
- });
1389
- }),
1390
- //处理线的参数
1391
- lineOption = {
1392
- strokeColor: cg.color,
1393
- // 线颜色
1394
- strokeWeight: cg.lineWidth,
1395
- // 线宽
1396
- strokeOpacity: cg.lineType == 'dashed' ? 0 : cg.pellucidity,
1397
- // 线透明度
1398
- icons: icons
1399
- };
1400
- //修改线点位数据
1401
- gc.setPath(linePath);
1402
- //修改线配置
1403
- gc.setOptions(lineOption);
1404
- //判断线显示和隐藏
1593
+ return new google.maps.LatLng({
1594
+ lng: item[0],
1595
+ lat: item[1]
1596
+ });
1597
+ }),
1598
+ //处理线的参数
1599
+ lineOption = {
1600
+ strokeColor: cg.color,
1601
+ // 线颜色
1602
+ strokeWeight: cg.lineWidth,
1603
+ // 线宽
1604
+ strokeOpacity: cg.lineType == 'dashed' ? 0 : cg.pellucidity,
1605
+ // 线透明度
1606
+ icons: icons
1607
+ }; //修改线点位数据
1608
+
1609
+ gc.setPath(linePath); //修改线配置
1610
+
1611
+ gc.setOptions(lineOption); //判断线显示和隐藏
1612
+
1405
1613
  if (cg.isHidden) {
1406
1614
  gc.setVisible(false);
1407
1615
  } else {
1408
1616
  gc.setVisible(true);
1409
1617
  }
1618
+
1410
1619
  t.GM.setGraphicParam(item.id, {
1411
1620
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1412
1621
  paths: item.paths,
@@ -1419,60 +1628,66 @@ var Map = /*#__PURE__*/function (_React$Component) {
1419
1628
  }
1420
1629
  });
1421
1630
  });
1422
- }
1423
- //添加面
1631
+ } //添加面
1632
+
1424
1633
  }, {
1425
1634
  key: "addPolygon",
1426
1635
  value: function addPolygon(mapPolygons) {
1427
1636
  var t = this;
1428
- var pgsids = _toConsumableArray(t.state.polygonIds);
1429
- //遍历添加面(图元)
1637
+
1638
+ var pgsids = _toConsumableArray(t.state.polygonIds); //遍历添加面(图元)
1639
+
1640
+
1430
1641
  mapPolygons.map(function (item, index) {
1431
1642
  //如果id重复,直接跳过不执行.
1432
1643
  if (t.GM.isRepetition(item.id)) {
1433
1644
  console.warn("\u591A\u8FB9\u5F62id: ".concat(item.id, " \u91CD\u590D"));
1434
1645
  return false;
1435
- }
1436
- //多边形点位数据不符合,直接跳过
1646
+ } //多边形点位数据不符合,直接跳过
1647
+
1648
+
1437
1649
  if (!(item.rings && item.rings.length >= 3)) {
1438
1650
  console.warn("\u591A\u8FB9\u5F62rings\u6570\u636E\u9519\u8BEF");
1439
1651
  return false;
1440
- }
1441
- //初始化参数
1652
+ } //初始化参数
1653
+
1654
+
1442
1655
  var cg = {
1443
1656
  lineType: 'solid',
1444
1657
  lineWidth: 5,
1445
1658
  lineColor: '#277ffa',
1446
1659
  lineOpacity: 1,
1447
1660
  color: '#fff',
1448
- pellucidity: 0.5
1449
- // isHidden: false //后期需要再加
1661
+ pellucidity: 0.5 // isHidden: false //后期需要再加
1662
+
1450
1663
  };
1664
+
1451
1665
  if (item.config) {
1452
1666
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1453
- }
1454
- //面的参数
1667
+ } //面的参数
1668
+
1669
+
1455
1670
  var polygonOption = {
1456
- strokeColor: cg.lineColor,
1457
- strokeOpacity: cg.lineOpacity,
1458
- strokeWeight: cg.lineWidth,
1459
- strokeStyle: cg.lineType,
1460
- fillColor: cg.color,
1461
- fillOpacity: cg.pellucidity
1462
- },
1463
- polygonPath = item.rings.map(function (item, index) {
1464
- return new google.maps.LatLng({
1465
- lng: item[0],
1466
- lat: item[1]
1467
- });
1671
+ strokeColor: cg.lineColor,
1672
+ strokeOpacity: cg.lineOpacity,
1673
+ strokeWeight: cg.lineWidth,
1674
+ strokeStyle: cg.lineType,
1675
+ fillColor: cg.color,
1676
+ fillOpacity: cg.pellucidity
1677
+ },
1678
+ polygonPath = item.rings.map(function (item, index) {
1679
+ return new google.maps.LatLng({
1680
+ lng: item[0],
1681
+ lat: item[1]
1468
1682
  });
1469
- //创建面对象
1683
+ }); //创建面对象
1684
+
1470
1685
  var polygon = new google.maps.Polygon(_objectSpread(_objectSpread({}, polygonOption), {}, {
1471
1686
  paths: polygonPath
1472
- }));
1473
- //添加面至地图
1474
- polygon.setMap(t.state.gis);
1475
- //点击事件
1687
+ })); //添加面至地图
1688
+
1689
+ polygon.setMap(t.state.gis); //点击事件
1690
+
1476
1691
  var mClick = polygon.addListener('click', function (e) {
1477
1692
  //避免鼠标在图元上 测距工具不起作用
1478
1693
  if (t.rangingTool.isRanging) {
@@ -1480,18 +1695,18 @@ var Map = /*#__PURE__*/function (_React$Component) {
1480
1695
  } else {
1481
1696
  t.clickGraphic(item.id, e);
1482
1697
  }
1483
- });
1484
- //鼠标移入事件
1698
+ }); //鼠标移入事件
1699
+
1485
1700
  var mMouseover = polygon.addListener('mouseover', function (e) {
1486
1701
  t.mouseOverGraphic(item.id, e);
1487
- });
1488
- //鼠标移出事件
1702
+ }); //鼠标移出事件
1703
+
1489
1704
  var mMouseout = polygon.addListener('mouseout', function (e) {
1490
1705
  t.mouseOutGraphic(item.id, e);
1491
- });
1492
- //缓存面id
1493
- pgsids.push(item.id);
1494
- //缓存面图元对象和对于传入数据
1706
+ }); //缓存面id
1707
+
1708
+ pgsids.push(item.id); //缓存面图元对象和对于传入数据
1709
+
1495
1710
  t.GM.setGraphic(item.id, polygon).setGraphicParam(item.id, {
1496
1711
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1497
1712
  rings: item.rings,
@@ -1508,12 +1723,11 @@ var Map = /*#__PURE__*/function (_React$Component) {
1508
1723
  mouseout: mMouseout
1509
1724
  });
1510
1725
  });
1511
- t.state.polygonIds = pgsids;
1512
- // t.setState({
1726
+ t.state.polygonIds = pgsids; // t.setState({
1513
1727
  // polygonIds: pgsids
1514
1728
  // });
1515
- }
1516
- //更新面
1729
+ } //更新面
1730
+
1517
1731
  }, {
1518
1732
  key: "updatePolygon",
1519
1733
  value: function updatePolygon(mapPolygons) {
@@ -1525,40 +1739,43 @@ var Map = /*#__PURE__*/function (_React$Component) {
1525
1739
  if (!(item.rings && item.rings.length >= 3)) {
1526
1740
  console.warn("\u591A\u8FB9\u5F62rings\u6570\u636E\u9519\u8BEF");
1527
1741
  return false;
1528
- }
1529
- //获取原有的图元
1530
- var gc = t.GM.getGraphic(item.id);
1531
- //初始化参数
1742
+ } //获取原有的图元
1743
+
1744
+
1745
+ var gc = t.GM.getGraphic(item.id); //初始化参数
1746
+
1532
1747
  var cg = {
1533
1748
  lineType: 'solid',
1534
1749
  lineWidth: 5,
1535
1750
  lineColor: '#277ffa',
1536
1751
  lineOpacity: 1,
1537
1752
  color: '#fff',
1538
- pellucidity: 0.5
1539
- // isHidden: false //后期需要再加
1753
+ pellucidity: 0.5 // isHidden: false //后期需要再加
1754
+
1540
1755
  };
1756
+
1541
1757
  if (item.config) {
1542
1758
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1543
- }
1544
- //面的参数
1759
+ } //面的参数
1760
+
1761
+
1545
1762
  var polygonOption = {
1546
- strokeColor: cg.lineColor,
1547
- strokeOpacity: cg.lineOpacity,
1548
- strokeWeight: cg.lineWidth,
1549
- strokeStyle: cg.lineType,
1550
- fillColor: cg.color,
1551
- fillOpacity: cg.pellucidity
1552
- },
1553
- polygonPath = item.rings.map(function (item, index) {
1554
- return new google.maps.LatLng({
1555
- lng: item[0],
1556
- lat: item[1]
1557
- });
1763
+ strokeColor: cg.lineColor,
1764
+ strokeOpacity: cg.lineOpacity,
1765
+ strokeWeight: cg.lineWidth,
1766
+ strokeStyle: cg.lineType,
1767
+ fillColor: cg.color,
1768
+ fillOpacity: cg.pellucidity
1769
+ },
1770
+ polygonPath = item.rings.map(function (item, index) {
1771
+ return new google.maps.LatLng({
1772
+ lng: item[0],
1773
+ lat: item[1]
1558
1774
  });
1559
- //更新经纬度
1560
- gc.setPath(polygonPath);
1561
- //更新 多边形 参数
1775
+ }); //更新经纬度
1776
+
1777
+ gc.setPath(polygonPath); //更新 多边形 参数
1778
+
1562
1779
  gc.setOptions(polygonOption);
1563
1780
  t.GM.setGraphicParam(item.id, {
1564
1781
  attributes: _objectSpread(_objectSpread({}, item), {}, {
@@ -1576,57 +1793,63 @@ var Map = /*#__PURE__*/function (_React$Component) {
1576
1793
  return false;
1577
1794
  }
1578
1795
  });
1579
- }
1580
- //添加圆 circle
1796
+ } //添加圆 circle
1797
+
1581
1798
  }, {
1582
1799
  key: "addCircle",
1583
1800
  value: function addCircle(mapCircles) {
1584
1801
  var t = this;
1802
+
1585
1803
  var ccsids = _toConsumableArray(t.state.circleIds);
1804
+
1586
1805
  mapCircles.map(function (item, index) {
1587
1806
  //如果id重复,直接跳过不执行.
1588
1807
  if (t.GM.isRepetition(item.id)) {
1589
1808
  console.warn("\u5706id: ".concat(item.id, " \u91CD\u590D"));
1590
1809
  return false;
1591
- }
1592
- //圆 点位数据不符合,直接跳过
1810
+ } //圆 点位数据不符合,直接跳过
1811
+
1812
+
1593
1813
  if (!item.longitude || !item.latitude) {
1594
1814
  console.warn("\u5706 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
1595
1815
  return false;
1596
1816
  }
1817
+
1597
1818
  var cg = {
1598
1819
  lineType: 'solid',
1599
1820
  lineWidth: 5,
1600
1821
  lineColor: '#277ffa',
1601
1822
  lineOpacity: 1,
1602
1823
  color: '#fff',
1603
- pellucidity: 0.5
1604
- // isHidden: false //后期需要在加
1824
+ pellucidity: 0.5 // isHidden: false //后期需要在加
1825
+
1605
1826
  };
1827
+
1606
1828
  if (item.config) {
1607
1829
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1608
- }
1609
- //初始化配置数据
1830
+ } //初始化配置数据
1831
+
1832
+
1610
1833
  var circleOption = {
1611
- strokeColor: cg.lineColor,
1612
- strokeOpacity: cg.lineOpacity,
1613
- strokeWeight: cg.lineWidth,
1614
- strokeStyle: cg.lineType,
1615
- fillColor: cg.color,
1616
- fillOpacity: cg.pellucidity
1617
- },
1618
- centerPoint = new google.maps.LatLng({
1619
- lng: item.longitude,
1620
- lat: item.latitude
1621
- });
1622
- //创建圆图元实例
1834
+ strokeColor: cg.lineColor,
1835
+ strokeOpacity: cg.lineOpacity,
1836
+ strokeWeight: cg.lineWidth,
1837
+ strokeStyle: cg.lineType,
1838
+ fillColor: cg.color,
1839
+ fillOpacity: cg.pellucidity
1840
+ },
1841
+ centerPoint = new google.maps.LatLng({
1842
+ lng: item.longitude,
1843
+ lat: item.latitude
1844
+ }); //创建圆图元实例
1845
+
1623
1846
  var circle = new google.maps.Circle(_objectSpread(_objectSpread({}, circleOption), {}, {
1624
1847
  radius: item.radius,
1625
1848
  center: centerPoint
1626
- }));
1627
- //添加圆至地图
1628
- circle.setMap(t.state.gis);
1629
- //点击事件
1849
+ })); //添加圆至地图
1850
+
1851
+ circle.setMap(t.state.gis); //点击事件
1852
+
1630
1853
  var mClick = circle.addListener('click', function (e) {
1631
1854
  //避免鼠标在图元上 测距工具不起作用
1632
1855
  if (t.rangingTool.isRanging) {
@@ -1634,17 +1857,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
1634
1857
  } else {
1635
1858
  t.clickGraphic(item.id, e);
1636
1859
  }
1637
- });
1638
- //鼠标移入事件
1860
+ }); //鼠标移入事件
1861
+
1639
1862
  var mMouseover = circle.addListener('mouseover', function (e) {
1640
1863
  t.mouseOverGraphic(item.id, e);
1641
- });
1642
- //鼠标移出事件
1864
+ }); //鼠标移出事件
1865
+
1643
1866
  var mMouseout = circle.addListener('mouseout', function (e) {
1644
1867
  t.mouseOutGraphic(item.id, e);
1645
1868
  });
1646
- ccsids.push(item.id);
1647
- //缓存数据
1869
+ ccsids.push(item.id); //缓存数据
1870
+
1648
1871
  t.GM.setGraphic(item.id, circle).setGraphicParam(item.id, {
1649
1872
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1650
1873
  other: item
@@ -1662,12 +1885,11 @@ var Map = /*#__PURE__*/function (_React$Component) {
1662
1885
  mouseout: mMouseout
1663
1886
  });
1664
1887
  });
1665
- t.state.circleIds = ccsids;
1666
- // t.setState({
1888
+ t.state.circleIds = ccsids; // t.setState({
1667
1889
  // circleIds: ccsids
1668
1890
  // });
1669
- }
1670
- //更新圆
1891
+ } //更新圆
1892
+
1671
1893
  }, {
1672
1894
  key: "updateCircle",
1673
1895
  value: function updateCircle(mapCircles) {
@@ -1679,42 +1901,45 @@ var Map = /*#__PURE__*/function (_React$Component) {
1679
1901
  if (!item.longitude || !item.latitude) {
1680
1902
  console.warn("\u5706 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
1681
1903
  return false;
1682
- }
1683
- //获取原有的图元
1684
- var gc = t.GM.getGraphic(item.id);
1685
- //获取原有的面属性,转换key值
1904
+ } //获取原有的图元
1905
+
1906
+
1907
+ var gc = t.GM.getGraphic(item.id); //获取原有的面属性,转换key值
1908
+
1686
1909
  var cg = {
1687
1910
  lineType: 'solid',
1688
1911
  lineWidth: 5,
1689
1912
  lineColor: '#277ffa',
1690
1913
  lineOpacity: 1,
1691
1914
  color: '#fff',
1692
- pellucidity: 0.5
1693
- // isHidden: false //后期需要在加
1915
+ pellucidity: 0.5 // isHidden: false //后期需要在加
1916
+
1694
1917
  };
1918
+
1695
1919
  if (item.config) {
1696
1920
  cg = _objectSpread(_objectSpread({}, cg), item.config);
1697
- }
1698
- //初始化配置数据
1921
+ } //初始化配置数据
1922
+
1923
+
1699
1924
  var circleOption = {
1700
- strokeColor: cg.lineColor,
1701
- strokeOpacity: cg.lineOpacity,
1702
- strokeWeight: cg.lineWidth,
1703
- strokeStyle: cg.lineType,
1704
- fillColor: cg.color,
1705
- fillOpacity: cg.pellucidity
1706
- },
1707
- centerPoint = new google.maps.LatLng({
1708
- lng: item.longitude,
1709
- lat: item.latitude
1710
- });
1711
- //修改中心点
1712
- gc.setCenter(centerPoint);
1713
- //修改半径
1714
- gc.setRadius(item.radius);
1715
- //修改圆 参数
1716
- gc.setOptions(circleOption);
1717
- //缓存图元的数据,便于后期操作
1925
+ strokeColor: cg.lineColor,
1926
+ strokeOpacity: cg.lineOpacity,
1927
+ strokeWeight: cg.lineWidth,
1928
+ strokeStyle: cg.lineType,
1929
+ fillColor: cg.color,
1930
+ fillOpacity: cg.pellucidity
1931
+ },
1932
+ centerPoint = new google.maps.LatLng({
1933
+ lng: item.longitude,
1934
+ lat: item.latitude
1935
+ }); //修改中心点
1936
+
1937
+ gc.setCenter(centerPoint); //修改半径
1938
+
1939
+ gc.setRadius(item.radius); //修改圆 参数
1940
+
1941
+ gc.setOptions(circleOption); //缓存图元的数据,便于后期操作
1942
+
1718
1943
  t.GM.setGraphicParam(item.id, {
1719
1944
  attributes: _objectSpread(_objectSpread({}, item), {}, {
1720
1945
  other: item
@@ -1732,8 +1957,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
1732
1957
  return false;
1733
1958
  }
1734
1959
  });
1735
- }
1736
- //热力图
1960
+ } //热力图
1961
+
1737
1962
  }, {
1738
1963
  key: "heatMapOverlay",
1739
1964
  value: function heatMapOverlay() {
@@ -1745,36 +1970,43 @@ var Map = /*#__PURE__*/function (_React$Component) {
1745
1970
  visible: true,
1746
1971
  opacity: 0.7
1747
1972
  };
1973
+
1748
1974
  if (d.config) {
1749
1975
  cg = _objectSpread(_objectSpread({}, cg), d.config);
1750
1976
  }
1977
+
1751
1978
  if (!t.heatmap) {
1752
1979
  t.heatmap = new google.maps.visualization.HeatmapLayer({
1753
1980
  map: t.state.gis
1754
1981
  });
1755
1982
  }
1983
+
1756
1984
  var option = {
1757
1985
  radius: cg.radius,
1758
1986
  //百度是1-100,高德是0-1
1759
- opacity: cg.visible ? cg.opacity : 0
1760
- // maxIntensity: cg.max
1987
+ opacity: cg.visible ? cg.opacity : 0 // maxIntensity: cg.max
1988
+
1761
1989
  };
1990
+
1762
1991
  if (cg.gradient) {
1763
- option.gradient = ['rgba(102,255, 0,0)'];
1764
- //将gradient排序,与其他地图的热力图数据一致
1992
+ option.gradient = ['rgba(102,255, 0,0)']; //将gradient排序,与其他地图的热力图数据一致
1993
+
1765
1994
  var sortArray = [];
1995
+
1766
1996
  for (var i in cg.gradient) {
1767
1997
  sortArray.push({
1768
1998
  key: i,
1769
1999
  value: cg.gradient[i]
1770
2000
  });
1771
2001
  }
2002
+
1772
2003
  option.gradient = [].concat(_toConsumableArray(option.gradient), _toConsumableArray(sortArray.sort(function (a, b) {
1773
2004
  return a.key > b.key;
1774
2005
  }).map(function (item) {
1775
2006
  return item.value;
1776
2007
  })));
1777
2008
  }
2009
+
1778
2010
  t.heatmap.setOptions(option);
1779
2011
  t.heatmap.setData((d.data || []).map(function (item, index) {
1780
2012
  return new google.maps.LatLng({
@@ -1782,16 +2014,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
1782
2014
  lat: item.lat
1783
2015
  });
1784
2016
  }));
1785
- }
1786
- //添加海量点
2017
+ } //添加海量点
2018
+
1787
2019
  }, {
1788
2020
  key: "addPointCollection",
1789
2021
  value: function addPointCollection() {
1790
2022
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1791
- var t = this;
1792
- //处理海量点
2023
+ var t = this; //处理海量点
2024
+
1793
2025
  var panes = t.canvasProjectionOverlay.getPanes(),
1794
- ftp = t.canvasProjectionOverlay.getProjection();
2026
+ ftp = t.canvasProjectionOverlay.getProjection();
2027
+
1795
2028
  if (panes) {
1796
2029
  if (!t.pointCollectionId) {
1797
2030
  t.pointCollectionId = "".concat(t.props.mapId, "_vtx_gmap_html_pointCollection");
@@ -1802,6 +2035,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
1802
2035
  divpc.id = t.pointCollectionId;
1803
2036
  panes.markerLayer.appendChild(divpc);
1804
2037
  }
2038
+
1805
2039
  data.map(function (item, index) {
1806
2040
  var d = item || {};
1807
2041
  var points = (d.points || []).map(function (d, i) {
@@ -1828,18 +2062,20 @@ var Map = /*#__PURE__*/function (_React$Component) {
1828
2062
  if (t.addpointCollectionTimer) {
1829
2063
  clearTimeout(t.addpointCollectionTimer);
1830
2064
  }
2065
+
1831
2066
  t.addpointCollectionTimer = setTimeout(function () {
1832
2067
  t.addPointCollection(data);
1833
2068
  }, 50);
1834
2069
  }
1835
- }
1836
- //更新海量点
2070
+ } //更新海量点
2071
+
1837
2072
  }, {
1838
2073
  key: "updatePointCollection",
1839
2074
  value: function updatePointCollection() {
1840
2075
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1841
2076
  var t = this;
1842
2077
  var ftp = t.canvasProjectionOverlay.getProjection();
2078
+
1843
2079
  if (ftp) {
1844
2080
  data.map(function (ds, ind) {
1845
2081
  t.morepoints.map(function (item, index) {
@@ -1864,12 +2100,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
1864
2100
  if (t.updatePointCollectionTimer) {
1865
2101
  clearTimeout(t.updatePointCollectionTimer);
1866
2102
  }
2103
+
1867
2104
  t.updatePointCollectionTimer = setTimeout(function () {
1868
2105
  t.addPointCollection(data);
1869
2106
  }, 50);
1870
2107
  }
1871
- }
1872
- //删除海量点
2108
+ } //删除海量点
2109
+
1873
2110
  }, {
1874
2111
  key: "clearPointCollection",
1875
2112
  value: function clearPointCollection() {
@@ -1882,8 +2119,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
1882
2119
  }
1883
2120
  });
1884
2121
  });
1885
- }
1886
- //删除全部海量点
2122
+ } //删除全部海量点
2123
+
1887
2124
  }, {
1888
2125
  key: "clearAllPointCollection",
1889
2126
  value: function clearAllPointCollection() {
@@ -1891,115 +2128,139 @@ var Map = /*#__PURE__*/function (_React$Component) {
1891
2128
  t.morepoints.map(function (item, index) {
1892
2129
  item.value.clear();
1893
2130
  });
1894
- }
1895
- //删除图元
2131
+ } //删除图元
2132
+
1896
2133
  }, {
1897
2134
  key: "removeGraphic",
1898
2135
  value: function removeGraphic(id, type) {
1899
2136
  var t = this;
1900
2137
  var graphic = t.GM.getGraphic(id),
1901
- gc_label = t.GM.getGraphic("".concat(id, "_vtxoMap_label"));
1902
- //删除点聚合效果
2138
+ gc_label = t.GM.getGraphic("".concat(id, "_vtxoMap_label")); //删除点聚合效果
2139
+
1903
2140
  if (t.clusterIdList.indexOf(id) > -1) {
1904
2141
  t.removeCluster(id);
1905
2142
  }
2143
+
1906
2144
  if (graphic) {
1907
2145
  //清除地图中图元
1908
- graphic.setMap(null);
1909
- //清除对应id的图元数据缓存
2146
+ graphic.setMap(null); //清除对应id的图元数据缓存
2147
+
1910
2148
  t.GM.removeGraphic(id);
1911
2149
  } else {
1912
2150
  return false;
1913
- }
1914
- //删除点位label
2151
+ } //删除点位label
2152
+
2153
+
1915
2154
  if (gc_label) {
1916
2155
  gc_label.setMap(null);
1917
2156
  t.GM.removeGraphic("".concat(id, "_vtxoMap_label"));
1918
2157
  }
2158
+
1919
2159
  for (var i = 0; i < t.movePoints.length; i++) {
1920
2160
  if (t.movePoints[i].id == id) {
1921
2161
  t.movePoints.splice(i, 1);
1922
2162
  continue;
1923
2163
  }
1924
2164
  }
2165
+
1925
2166
  var ids = [];
2167
+
1926
2168
  switch (type) {
1927
2169
  case 'point':
1928
2170
  ids = t.state.pointIds;
1929
2171
  break;
2172
+
1930
2173
  case 'line':
1931
2174
  ids = t.state.lineIds;
1932
2175
  break;
2176
+
1933
2177
  case 'polygon':
1934
2178
  ids = t.state.polygonIds;
1935
2179
  break;
2180
+
1936
2181
  case 'circle':
1937
2182
  ids = t.state.circleIds;
1938
2183
  break;
2184
+
1939
2185
  case 'draw':
1940
2186
  if (t.state.drawIds.point.indexOf(id) > -1) {
1941
2187
  t.state.drawIds.point.splice(t.state.drawIds.point.indexOf(id), 1);
1942
2188
  }
2189
+
1943
2190
  if (t.state.drawIds.polyline.indexOf(id) > -1) {
1944
2191
  t.state.drawIds.polyline.splice(t.state.drawIds.polyline.indexOf(id), 1);
1945
2192
  }
2193
+
1946
2194
  if (t.state.drawIds.polygon.indexOf(id) > -1) {
1947
2195
  t.state.drawIds.polygon.splice(t.state.drawIds.polygon.indexOf(id), 1);
1948
2196
  }
2197
+
1949
2198
  if (t.state.drawIds.circle.indexOf(id) > -1) {
1950
2199
  t.state.drawIds.circle.splice(t.state.drawIds.circle.indexOf(id), 1);
1951
2200
  }
2201
+
1952
2202
  if (t.state.drawIds.rectangle.indexOf(id) > -1) {
1953
2203
  t.state.drawIds.rectangle.splice(t.state.drawIds.rectangle.indexOf(id), 1);
1954
2204
  }
2205
+
1955
2206
  break;
2207
+
1956
2208
  default:
1957
2209
  if (t.state.pointIds.indexOf(id) > -1) {
1958
2210
  t.state.pointIds.splice(t.state.pointIds.indexOf(id), 1);
1959
2211
  }
2212
+
1960
2213
  if (t.state.lineIds.indexOf(id) > -1) {
1961
2214
  t.state.lineIds.splice(t.state.lineIds.indexOf(id), 1);
1962
2215
  }
2216
+
1963
2217
  if (t.state.polygonIds.indexOf(id) > -1) {
1964
2218
  t.state.polygonIds.splice(t.state.polygonIds.indexOf(id), 1);
1965
2219
  }
2220
+
1966
2221
  if (t.state.circleIds.indexOf(id) > -1) {
1967
2222
  t.state.circleIds.splice(t.state.circleIds.indexOf(id), 1);
1968
2223
  }
2224
+
1969
2225
  break;
1970
2226
  }
2227
+
1971
2228
  if (id == t.state.editId) {
1972
2229
  t.state.editId = '';
1973
2230
  }
2231
+
1974
2232
  if (ids.indexOf(id) != -1) {
1975
2233
  ids.splice(ids.indexOf(id), 1);
1976
2234
  }
1977
2235
  }
1978
2236
  /*根据图元id,使图元变成可编辑状态*/
2237
+
1979
2238
  }, {
1980
2239
  key: "doEdit",
1981
2240
  value: function doEdit(id) {
1982
- var t = this;
1983
- //获取编辑点的图元和参数
2241
+ var t = this; //获取编辑点的图元和参数
2242
+
1984
2243
  var graphic = t.GM.getGraphic(id),
1985
- gLabel = t.GM.getGraphic("".concat(id, "_vtxoMap_label")),
1986
- gtp = t.GM.getGraphicParam(id);
1987
- if (!graphic) return false;
1988
- //关闭先前编辑的图元
2244
+ gLabel = t.GM.getGraphic("".concat(id, "_vtxoMap_label")),
2245
+ gtp = t.GM.getGraphicParam(id);
2246
+ if (!graphic) return false; //关闭先前编辑的图元
2247
+
1989
2248
  if (!!t.state.editId) {
1990
2249
  t.endEdit();
1991
2250
  }
2251
+
1992
2252
  if (!t.editGraphicChange) {
1993
2253
  //编辑变动后
1994
2254
  t.editGraphicChange = function (e) {
1995
2255
  var id = t.state.editId,
1996
- param = t.getGraphic(id),
1997
- obj = {
1998
- param: param,
1999
- e: e,
2000
- id: id,
2001
- geometry: param.geometry
2002
- };
2256
+ param = t.getGraphic(id),
2257
+ obj = {
2258
+ param: param,
2259
+ e: e,
2260
+ id: id,
2261
+ geometry: param.geometry
2262
+ };
2263
+
2003
2264
  if (param.geometry.type == 'polygon') {
2004
2265
  if (google.maps.geometry && google.maps.geometry.spherical) {
2005
2266
  obj.area = google.maps.geometry.spherical.computeArea(param.mapLayer.getPath().getArray());
@@ -2007,14 +2268,18 @@ var Map = /*#__PURE__*/function (_React$Component) {
2007
2268
  obj.area = 0;
2008
2269
  }
2009
2270
  }
2271
+
2010
2272
  if (param.geometry.type == 'polyline') {
2011
2273
  obj.distance = t.calculateDistance(param.geometry.paths);
2012
2274
  }
2275
+
2013
2276
  if (param.geometry.type == 'circle') {
2014
2277
  obj.area = Math.pow(param.geometry.radius, 2) * Math.PI;
2278
+
2015
2279
  if (t.editTimeout) {
2016
2280
  clearTimeout(t.editTimeout);
2017
2281
  }
2282
+
2018
2283
  t.editTimeout = setTimeout(function () {
2019
2284
  t.setState({
2020
2285
  editGraphic: obj
@@ -2031,46 +2296,53 @@ var Map = /*#__PURE__*/function (_React$Component) {
2031
2296
  }
2032
2297
  };
2033
2298
  }
2299
+
2034
2300
  switch (gtp.geometryType) {
2035
2301
  case 'point':
2036
2302
  graphic.setDraggable(true);
2037
- t.editEvent['dragend'] = graphic.addListener("dragend", t.editGraphicChange);
2038
- //判断是否是 markerContent 再判断是否有label
2303
+ t.editEvent['dragend'] = graphic.addListener("dragend", t.editGraphicChange); //判断是否是 markerContent 再判断是否有label
2304
+
2039
2305
  if (!gtp.attributes.markerContent && gLabel) {
2040
2306
  //label事件对象 便于删除
2041
2307
  t.editPointLabel = graphic.addListener("drag", function (event) {
2042
2308
  gLabel.setPosition(event.latLng);
2043
2309
  });
2044
2310
  }
2311
+
2045
2312
  break;
2313
+
2046
2314
  case 'polyline':
2047
2315
  case 'polygon':
2048
2316
  case 'rectangle':
2049
2317
  graphic.setEditable(true);
2050
2318
  t.editEvent['mouseup'] = graphic.addListener("mouseup", t.editGraphicChange);
2051
2319
  break;
2320
+
2052
2321
  case 'circle':
2053
2322
  graphic.setEditable(true);
2054
2323
  t.editEvent['center_changed'] = graphic.addListener("center_changed", t.editGraphicChange);
2055
2324
  t.editEvent['radius_changed'] = graphic.addListener("radius_changed", t.editGraphicChange);
2056
2325
  break;
2057
2326
  }
2327
+
2058
2328
  t.setState({
2059
2329
  editId: id
2060
2330
  });
2061
- }
2062
- //关闭编辑
2331
+ } //关闭编辑
2332
+
2063
2333
  }, {
2064
2334
  key: "endEdit",
2065
2335
  value: function endEdit() {
2066
- var t = this;
2067
- //获取编辑点的图元和参数
2336
+ var t = this; //获取编辑点的图元和参数
2337
+
2068
2338
  var graphic = t.GM.getGraphic(t.state.editId);
2069
2339
  var gtp = t.GM.getGraphicParam(t.state.editId);
2070
2340
  if (!graphic) return false;
2341
+
2071
2342
  switch (gtp.geometryType) {
2072
2343
  case 'point':
2073
2344
  graphic.setDraggable(false);
2345
+
2074
2346
  if (graphic.removeListener) {
2075
2347
  graphic.removeListener("dragend", t.editGraphicChange);
2076
2348
  } else {
@@ -2079,27 +2351,34 @@ var Map = /*#__PURE__*/function (_React$Component) {
2079
2351
  t.editEvent[i].remove();
2080
2352
  }
2081
2353
  }
2354
+
2082
2355
  if (t.editPointLabel) {
2083
2356
  t.editPointLabel.remove();
2084
2357
  t.editPointLabel = null;
2085
2358
  }
2086
2359
  }
2360
+
2087
2361
  break;
2362
+
2088
2363
  case 'polyline':
2089
2364
  case 'polygon':
2090
2365
  case 'rectangle':
2091
2366
  case 'circle':
2092
2367
  graphic.setEditable(false);
2368
+
2093
2369
  for (var _i2 in t.editEvent) {
2094
2370
  if (t.editEvent[_i2]) {
2095
2371
  t.editEvent[_i2].remove();
2096
2372
  }
2097
2373
  }
2374
+
2098
2375
  break;
2099
- }
2100
- //事件缓存制空,避免异常
2376
+ } //事件缓存制空,避免异常
2377
+
2378
+
2101
2379
  t.editEvent = {};
2102
2380
  var editGraphic = t.state.editGraphic;
2381
+
2103
2382
  if (editGraphic) {
2104
2383
  t.setState({
2105
2384
  editId: '',
@@ -2108,29 +2387,33 @@ var Map = /*#__PURE__*/function (_React$Component) {
2108
2387
  t.props.editGraphicChange(editGraphic);
2109
2388
  });
2110
2389
  }
2111
- }
2112
- //绘制图元
2390
+ } //绘制图元
2391
+
2113
2392
  }, {
2114
2393
  key: "draw",
2115
2394
  value: function draw(obj) {
2116
2395
  var t = this,
2117
- drawParam = {};
2118
- //先关闭(防止连点)
2119
- t._drawmanager.setDrawingMode(null);
2120
- //初始化参数
2396
+ drawParam = {}; //先关闭(防止连点)
2397
+
2398
+ t._drawmanager.setDrawingMode(null); //初始化参数
2399
+
2400
+
2121
2401
  drawParam.geometryType = obj.geometryType || 'point';
2122
2402
  drawParam.parameter = obj.parameter ? _objectSpread({}, obj.parameter) : {};
2123
2403
  drawParam.data = obj.data ? _objectSpread({}, obj.data) : {};
2124
- drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime());
2125
- //判断id是否存在
2404
+ drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime()); //判断id是否存在
2405
+
2126
2406
  var len = t.state.drawIds[drawParam.geometryType].indexOf(drawParam.data.id);
2407
+
2127
2408
  if (len > -1) {
2128
2409
  //如果id存在 删除存在的图元,清除drawId中的id数据
2129
2410
  t.removeGraphic(drawParam.data.id);
2130
2411
  t.state.drawIds[drawParam.geometryType].splice(len, 1);
2131
2412
  }
2413
+
2132
2414
  var param = {};
2133
2415
  var paramgcr = {};
2416
+
2134
2417
  if (drawParam.geometryType == 'polygon' || drawParam.geometryType == 'circle' || drawParam.geometryType == 'rectangle') {
2135
2418
  paramgcr.fillColor = drawParam.parameter.color;
2136
2419
  paramgcr.strokeColor = drawParam.parameter.lineColor;
@@ -2153,6 +2436,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
2153
2436
  type: drawParam.geometryType
2154
2437
  };
2155
2438
  }
2439
+
2156
2440
  switch (drawParam.geometryType) {
2157
2441
  case 'point':
2158
2442
  var icon = {
@@ -2164,18 +2448,23 @@ var Map = /*#__PURE__*/function (_React$Component) {
2164
2448
  scaledSize: new t.omap.Size(drawParam.parameter.width || 30, drawParam.parameter.height || 30),
2165
2449
  url: drawParam.parameter.url || "".concat(_default2["default"].mapServerURL, "/images/defaultMarker.png")
2166
2450
  };
2451
+
2167
2452
  t._drawmanager.setOptions({
2168
2453
  drawingControl: false,
2169
2454
  markerOptions: {
2170
2455
  icon: icon
2171
2456
  }
2172
2457
  });
2458
+
2173
2459
  t._drawmanager.setDrawingMode('marker');
2460
+
2174
2461
  t._drawmanagerEvent = t._drawmanager.addListener('markercomplete', function (e) {
2175
2462
  //清楚事件监听
2176
- t._drawmanagerEvent.remove();
2177
- //关闭绘制功能
2463
+ t._drawmanagerEvent.remove(); //关闭绘制功能
2464
+
2465
+
2178
2466
  t._drawmanager.setDrawingMode(null);
2467
+
2179
2468
  t.GM.setGraphic(drawParam.data.id, e);
2180
2469
  var backobj = {
2181
2470
  id: drawParam.data.id,
@@ -2194,8 +2483,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
2194
2483
  },
2195
2484
  geometryType: 'point',
2196
2485
  mapLayer: e
2197
- };
2198
- //点击事件
2486
+ }; //点击事件
2487
+
2199
2488
  var mClick = e.addListener('click', function (e) {
2200
2489
  //避免鼠标在图元上 测距工具不起作用
2201
2490
  if (t.rangingTool.isRanging) {
@@ -2203,12 +2492,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2203
2492
  } else {
2204
2493
  t.clickGraphic(drawParam.data.id, e);
2205
2494
  }
2206
- });
2207
- //鼠标移入事件
2495
+ }); //鼠标移入事件
2496
+
2208
2497
  var mMouseover = e.addListener('mouseover', function (e) {
2209
2498
  t.mouseOverGraphic(drawParam.data.id, e);
2210
- });
2211
- //鼠标移出事件
2499
+ }); //鼠标移出事件
2500
+
2212
2501
  var mMouseout = e.addListener('mouseout', function (e) {
2213
2502
  t.mouseOutGraphic(drawParam.data.id, e);
2214
2503
  });
@@ -2217,25 +2506,32 @@ var Map = /*#__PURE__*/function (_React$Component) {
2217
2506
  mouseover: mMouseover,
2218
2507
  mouseout: mMouseout
2219
2508
  });
2509
+
2220
2510
  if ('drawEnd' in t.props) {
2221
2511
  t.props.drawEnd(backobj);
2222
2512
  }
2223
2513
  });
2224
2514
  break;
2515
+
2225
2516
  case 'polyline':
2226
2517
  param.strokeColor = drawParam.parameter.color;
2227
2518
  param.strokeOpacity = drawParam.parameter.pellucidity;
2228
2519
  param.strokeWeight = drawParam.parameter.lineWidth;
2520
+
2229
2521
  t._drawmanager.setOptions({
2230
2522
  drawingControl: false,
2231
2523
  polylineOptions: param
2232
2524
  });
2525
+
2233
2526
  t._drawmanager.setDrawingMode('polyline');
2527
+
2234
2528
  t._drawmanagerEvent = t._drawmanager.addListener('polylinecomplete', function (e) {
2235
2529
  //清楚事件监听
2236
- t._drawmanagerEvent.remove();
2237
- //关闭绘制功能
2530
+ t._drawmanagerEvent.remove(); //关闭绘制功能
2531
+
2532
+
2238
2533
  t._drawmanager.setDrawingMode(null);
2534
+
2239
2535
  t.GM.setGraphic(drawParam.data.id, e);
2240
2536
  var paths = [];
2241
2537
  var lnglatAry = (e.getPath().getArray() || []).map(function (item, index) {
@@ -2267,8 +2563,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
2267
2563
  paths: (0, _MapToolFunction.getMaxMin)(paths).path
2268
2564
  },
2269
2565
  lnglatAry: lnglatAry
2270
- };
2271
- //点击事件
2566
+ }; //点击事件
2567
+
2272
2568
  var mClick = e.addListener('click', function (e) {
2273
2569
  //避免鼠标在图元上 测距工具不起作用
2274
2570
  if (t.rangingTool.isRanging) {
@@ -2276,12 +2572,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2276
2572
  } else {
2277
2573
  t.clickGraphic(drawParam.data.id, e);
2278
2574
  }
2279
- });
2280
- //鼠标移入事件
2575
+ }); //鼠标移入事件
2576
+
2281
2577
  var mMouseover = e.addListener('mouseover', function (e) {
2282
2578
  t.mouseOverGraphic(drawParam.data.id, e);
2283
- });
2284
- //鼠标移出事件
2579
+ }); //鼠标移出事件
2580
+
2285
2581
  var mMouseout = e.addListener('mouseout', function (e) {
2286
2582
  t.mouseOutGraphic(drawParam.data.id, e);
2287
2583
  });
@@ -2290,25 +2586,31 @@ var Map = /*#__PURE__*/function (_React$Component) {
2290
2586
  mouseover: mMouseover,
2291
2587
  mouseout: mMouseout
2292
2588
  });
2589
+
2293
2590
  if ('drawEnd' in t.props) {
2294
2591
  t.props.drawEnd(backobj);
2295
2592
  }
2296
2593
  });
2297
2594
  break;
2595
+
2298
2596
  case 'polygon':
2299
2597
  t._drawmanager.setOptions({
2300
2598
  drawingControl: false,
2301
2599
  polygonOptions: paramgcr
2302
2600
  });
2601
+
2303
2602
  t._drawmanager.setDrawingMode('polygon');
2603
+
2304
2604
  t._drawmanagerEvent = t._drawmanager.addListener('polygoncomplete', function (e) {
2305
2605
  //清楚事件监听
2306
- t._drawmanagerEvent.remove();
2307
- //关闭绘制功能
2606
+ t._drawmanagerEvent.remove(); //关闭绘制功能
2607
+
2608
+
2308
2609
  t._drawmanager.setDrawingMode(null);
2610
+
2309
2611
  t.GM.setGraphic(drawParam.data.id, e);
2310
2612
  var paths = [],
2311
- area = t.calculateArea(drawParam.data.id);
2613
+ area = t.calculateArea(drawParam.data.id);
2312
2614
  var lnglatAry = (e.getPath().getArray() || []).map(function (item, index) {
2313
2615
  paths.push({
2314
2616
  lng: item.lng(),
@@ -2342,8 +2644,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
2342
2644
  },
2343
2645
  lnglatAry: lnglatAry,
2344
2646
  area: area
2345
- };
2346
- //点击事件
2647
+ }; //点击事件
2648
+
2347
2649
  var mClick = e.addListener('click', function (e) {
2348
2650
  //避免鼠标在图元上 测距工具不起作用
2349
2651
  if (t.rangingTool.isRanging) {
@@ -2351,12 +2653,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2351
2653
  } else {
2352
2654
  t.clickGraphic(drawParam.data.id, e);
2353
2655
  }
2354
- });
2355
- //鼠标移入事件
2656
+ }); //鼠标移入事件
2657
+
2356
2658
  var mMouseover = e.addListener('mouseover', function (e) {
2357
2659
  t.mouseOverGraphic(drawParam.data.id, e);
2358
- });
2359
- //鼠标移出事件
2660
+ }); //鼠标移出事件
2661
+
2360
2662
  var mMouseout = e.addListener('mouseout', function (e) {
2361
2663
  t.mouseOutGraphic(drawParam.data.id, e);
2362
2664
  });
@@ -2365,22 +2667,28 @@ var Map = /*#__PURE__*/function (_React$Component) {
2365
2667
  mouseover: mMouseover,
2366
2668
  mouseout: mMouseout
2367
2669
  });
2670
+
2368
2671
  if ('drawEnd' in t.props) {
2369
2672
  t.props.drawEnd(backobj);
2370
2673
  }
2371
2674
  });
2372
2675
  break;
2676
+
2373
2677
  case 'circle':
2374
2678
  t._drawmanager.setOptions({
2375
2679
  drawingControl: false,
2376
2680
  circleOptions: paramgcr
2377
2681
  });
2682
+
2378
2683
  t._drawmanager.setDrawingMode('circle');
2684
+
2379
2685
  t._drawmanagerEvent = t._drawmanager.addListener('circlecomplete', function (e) {
2380
2686
  //清楚事件监听
2381
- t._drawmanagerEvent.remove();
2382
- //关闭绘制功能
2687
+ t._drawmanagerEvent.remove(); //关闭绘制功能
2688
+
2689
+
2383
2690
  t._drawmanager.setDrawingMode(null);
2691
+
2384
2692
  t.GM.setGraphic(drawParam.data.id, e);
2385
2693
  var area = Math.PI * Math.pow(e.getRadius(), 2);
2386
2694
  var backobj = {
@@ -2405,8 +2713,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
2405
2713
  area: area
2406
2714
  },
2407
2715
  area: area
2408
- };
2409
- //点击事件
2716
+ }; //点击事件
2717
+
2410
2718
  var mClick = e.addListener('click', function (e) {
2411
2719
  //避免鼠标在图元上 测距工具不起作用
2412
2720
  if (t.rangingTool.isRanging) {
@@ -2414,12 +2722,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2414
2722
  } else {
2415
2723
  t.clickGraphic(drawParam.data.id, e);
2416
2724
  }
2417
- });
2418
- //鼠标移入事件
2725
+ }); //鼠标移入事件
2726
+
2419
2727
  var mMouseover = e.addListener('mouseover', function (e) {
2420
2728
  t.mouseOverGraphic(drawParam.data.id, e);
2421
- });
2422
- //鼠标移出事件
2729
+ }); //鼠标移出事件
2730
+
2423
2731
  var mMouseout = e.addListener('mouseout', function (e) {
2424
2732
  t.mouseOutGraphic(drawParam.data.id, e);
2425
2733
  });
@@ -2428,22 +2736,28 @@ var Map = /*#__PURE__*/function (_React$Component) {
2428
2736
  mouseover: mMouseover,
2429
2737
  mouseout: mMouseout
2430
2738
  });
2739
+
2431
2740
  if ('drawEnd' in t.props) {
2432
2741
  t.props.drawEnd(backobj);
2433
2742
  }
2434
2743
  });
2435
2744
  break;
2745
+
2436
2746
  case 'rectangle':
2437
2747
  t._drawmanager.setOptions({
2438
2748
  drawingControl: false,
2439
2749
  rectangleOptions: paramgcr
2440
2750
  });
2751
+
2441
2752
  t._drawmanager.setDrawingMode('rectangle');
2753
+
2442
2754
  t._drawmanagerEvent = t._drawmanager.addListener('rectanglecomplete', function (e) {
2443
2755
  //清楚事件监听
2444
- t._drawmanagerEvent.remove();
2445
- //关闭绘制功能
2756
+ t._drawmanagerEvent.remove(); //关闭绘制功能
2757
+
2758
+
2446
2759
  t._drawmanager.setDrawingMode(null);
2760
+
2447
2761
  t.GM.setGraphic(drawParam.data.id, e);
2448
2762
  var lnglatJson = e.getBounds().toJSON();
2449
2763
  var paths = [{
@@ -2489,8 +2803,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
2489
2803
  },
2490
2804
  lnglatAry: lnglatAry,
2491
2805
  area: area
2492
- };
2493
- //点击事件
2806
+ }; //点击事件
2807
+
2494
2808
  var mClick = e.addListener('click', function (e) {
2495
2809
  //避免鼠标在图元上 测距工具不起作用
2496
2810
  if (t.rangingTool.isRanging) {
@@ -2498,12 +2812,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2498
2812
  } else {
2499
2813
  t.clickGraphic(drawParam.data.id, e);
2500
2814
  }
2501
- });
2502
- //鼠标移入事件
2815
+ }); //鼠标移入事件
2816
+
2503
2817
  var mMouseover = e.addListener('mouseover', function (e) {
2504
2818
  t.mouseOverGraphic(drawParam.data.id, e);
2505
- });
2506
- //鼠标移出事件
2819
+ }); //鼠标移出事件
2820
+
2507
2821
  var mMouseout = e.addListener('mouseout', function (e) {
2508
2822
  t.mouseOutGraphic(drawParam.data.id, e);
2509
2823
  });
@@ -2512,51 +2826,58 @@ var Map = /*#__PURE__*/function (_React$Component) {
2512
2826
  mouseover: mMouseover,
2513
2827
  mouseout: mMouseout
2514
2828
  });
2829
+
2515
2830
  if ('drawEnd' in t.props) {
2516
2831
  t.props.drawEnd(backobj);
2517
2832
  }
2518
2833
  });
2519
2834
  break;
2520
- }
2521
- //保存绘制图元的id便于后期比对
2835
+ } //保存绘制图元的id便于后期比对
2836
+
2837
+
2522
2838
  t.state.drawIds[drawParam.geometryType].push(drawParam.data.id);
2523
- }
2524
- //关闭绘制图元
2839
+ } //关闭绘制图元
2840
+
2525
2841
  }, {
2526
2842
  key: "closeDraw",
2527
2843
  value: function closeDraw() {
2528
2844
  var t = this;
2845
+
2529
2846
  t._drawmanager.setDrawingMode(null);
2530
2847
  }
2531
2848
  /*
2532
2849
  事件处理
2533
2850
  */
2534
2851
  //点击图元事件
2852
+
2535
2853
  }, {
2536
2854
  key: "clickGraphic",
2537
2855
  value: function clickGraphic(id, e) {
2538
- var t = this;
2539
- //判断是否点击的测距关闭点位
2856
+ var t = this; //判断是否点击的测距关闭点位
2857
+
2540
2858
  if (id && id.indexOf('vtx_g_rang_end') > -1) {
2541
2859
  var index = t.GM.getGraphicParam(id).attributes.index;
2542
2860
  var ls = t.rangingTools[index].line,
2543
- ps = t.rangingTools[index].points;
2544
- //删除测距线
2545
- t.removeGraphic(ls.id, 'line');
2546
- //删除关闭点
2547
- t.removeGraphic(id, 'point');
2548
- //删除中间点
2861
+ ps = t.rangingTools[index].points; //删除测距线
2862
+
2863
+ t.removeGraphic(ls.id, 'line'); //删除关闭点
2864
+
2865
+ t.removeGraphic(id, 'point'); //删除中间点
2866
+
2549
2867
  for (var i = 0; i < ps.length; i++) {
2550
2868
  t.removeGraphic(ps[i].id, 'point');
2551
- }
2552
- //清除测距数据缓存
2869
+ } //清除测距数据缓存
2870
+
2871
+
2553
2872
  delete t.rangingTools[index];
2554
2873
  } else {
2555
2874
  if (id.indexOf('vtx_g_rang_') > -1) {
2556
2875
  return false;
2557
- }
2558
- //编辑中的图元关闭其他事件返回
2876
+ } //编辑中的图元关闭其他事件返回
2877
+
2878
+
2559
2879
  if (t.state.editId == id) return false;
2880
+
2560
2881
  if (typeof t.props.clickGraphic === "function") {
2561
2882
  var param = t.getGraphic(id);
2562
2883
  var obj = {
@@ -2575,18 +2896,20 @@ var Map = /*#__PURE__*/function (_React$Component) {
2575
2896
  t.props.clickGraphic(obj);
2576
2897
  }
2577
2898
  }
2578
- }
2579
- //图元鼠标悬浮事件
2899
+ } //图元鼠标悬浮事件
2900
+
2580
2901
  }, {
2581
2902
  key: "mouseOverGraphic",
2582
2903
  value: function mouseOverGraphic(id, e) {
2583
- var t = this;
2584
- //编辑中的图元关闭其他事件返回
2904
+ var t = this; //编辑中的图元关闭其他事件返回
2905
+
2585
2906
  if (t.state.editId == id) return false;
2907
+
2586
2908
  if (typeof t.props.mouseOverGraphic === 'function') {
2587
2909
  if (id.indexOf('vtx_g_rang_') > -1) {
2588
2910
  return false;
2589
2911
  }
2912
+
2590
2913
  var obj = {
2591
2914
  e: e,
2592
2915
  id: id,
@@ -2597,18 +2920,20 @@ var Map = /*#__PURE__*/function (_React$Component) {
2597
2920
  };
2598
2921
  t.props.mouseOverGraphic(obj);
2599
2922
  }
2600
- }
2601
- //图元鼠标移开事件
2923
+ } //图元鼠标移开事件
2924
+
2602
2925
  }, {
2603
2926
  key: "mouseOutGraphic",
2604
2927
  value: function mouseOutGraphic(id, e) {
2605
- var t = this;
2606
- //编辑中的图元关闭其他事件返回
2928
+ var t = this; //编辑中的图元关闭其他事件返回
2929
+
2607
2930
  if (t.state.editId == id) return false;
2931
+
2608
2932
  if (typeof t.props.mouseOutGraphic === "function") {
2609
2933
  if (id.indexOf('vtx_g_rang_') > -1) {
2610
2934
  return false;
2611
2935
  }
2936
+
2612
2937
  var obj = {
2613
2938
  e: e,
2614
2939
  id: id,
@@ -2624,65 +2949,73 @@ var Map = /*#__PURE__*/function (_React$Component) {
2624
2949
  地图服务功能
2625
2950
  */
2626
2951
  //开启路况
2952
+
2627
2953
  }, {
2628
2954
  key: "openTrafficInfo",
2629
2955
  value: function openTrafficInfo() {
2630
2956
  var t = this;
2957
+
2631
2958
  if (!t.trafficLayer) {
2632
2959
  t.trafficLayer = new google.maps.TrafficLayer();
2633
2960
  }
2961
+
2634
2962
  t.trafficLayer.setMap(t.state.gis);
2635
- }
2636
- //关闭路况
2963
+ } //关闭路况
2964
+
2637
2965
  }, {
2638
2966
  key: "hideTrafficInfo",
2639
2967
  value: function hideTrafficInfo() {
2640
2968
  var t = this;
2969
+
2641
2970
  if (t.trafficLayer) {
2642
2971
  t.trafficLayer.setMap(null);
2643
2972
  }
2644
- }
2645
- //测距功能
2973
+ } //测距功能
2974
+
2646
2975
  }, {
2647
2976
  key: "vtxRangingTool",
2648
2977
  value: function vtxRangingTool(mapRangingTool) {
2649
2978
  var t = this;
2650
2979
  var _t$state2 = t.state,
2651
- lineIds = _t$state2.lineIds,
2652
- polygonIds = _t$state2.polygonIds,
2653
- circleIds = _t$state2.circleIds;
2980
+ lineIds = _t$state2.lineIds,
2981
+ polygonIds = _t$state2.polygonIds,
2982
+ circleIds = _t$state2.circleIds;
2654
2983
  var gids = [].concat(_toConsumableArray(lineIds), _toConsumableArray(polygonIds), _toConsumableArray(circleIds));
2655
2984
  t.state.gis.disableDoubleClickZoom = true;
2656
- t.state.gis.draggableCursor = 'crosshair';
2657
- //开启测距状态
2985
+ t.state.gis.draggableCursor = 'crosshair'; //开启测距状态
2986
+
2658
2987
  if (!t.rangingTool.isRanging) {
2659
2988
  t.rangingTool.isRanging = true;
2660
- }
2661
- //初始测距回调
2989
+ } //初始测距回调
2990
+
2991
+
2662
2992
  if (!t.rangingTool.mapRangingTool) {
2663
2993
  t.rangingTool.mapRangingTool = mapRangingTool;
2664
2994
  }
2995
+
2665
2996
  if (!t.rangingToolFun) {
2666
2997
  /*测距功能*/
2667
2998
  t.rangingToolFun = function (e, status) {
2668
2999
  var fun = function fun() {
2669
3000
  t.rangingTool.isDbclick = false;
3001
+
2670
3002
  if (t.rangingTool.isRanging) {
2671
3003
  //测距开始
2672
3004
  //点击位置
2673
3005
  var ftp = t.canvasProjectionOverlay.getProjection(),
2674
- lnglat = ftp.fromContainerPixelToLatLng(new google.maps.Point(e.va.x - t.mapLeft, e.va.y - t.mapTop)),
2675
- lnlt = [lnglat.lng(), lnglat.lat()];
2676
- //2个点以上 计算长度
3006
+ lnglat = ftp.fromContainerPixelToLatLng(new google.maps.Point(e.va.x - t.mapLeft, e.va.y - t.mapTop)),
3007
+ lnlt = [lnglat.lng(), lnglat.lat()]; //2个点以上 计算长度
3008
+
2677
3009
  if (t.rangingTool.points.length > 0) {
2678
3010
  t.rangingTool.distance += t.calculatePointsDistance(lnlt, [t.rangingTool.points[t.rangingTool.points.length - 1].longitude, t.rangingTool.points[t.rangingTool.points.length - 1].latitude]);
2679
3011
  } else {
2680
3012
  t.rangingTool.line.paths = [];
2681
3013
  }
2682
- t.rangingTool.line.paths.push([].concat(lnlt));
2683
- //处理距离展示
2684
- var distext = t.rangingTool.distance > 0 ? t.rangingTool.distance > 1000 ? "\u603B\u957F:".concat(Math.round(t.rangingTool.distance / 10) / 100, "\u516C\u91CC") : "\u603B\u957F:".concat(t.rangingTool.distance, "\u7C73") : '起点';
2685
- //加点
3014
+
3015
+ t.rangingTool.line.paths.push([].concat(lnlt)); //处理距离展示
3016
+
3017
+ var distext = t.rangingTool.distance > 0 ? t.rangingTool.distance > 1000 ? "\u603B\u957F:".concat(Math.round(t.rangingTool.distance / 10) / 100, "\u516C\u91CC") : "\u603B\u957F:".concat(t.rangingTool.distance, "\u7C73") : '起点'; //加点
3018
+
2686
3019
  var point = {
2687
3020
  id: t.rangingTool.points.length + 'vtx_g_rang_p' + Math.random(),
2688
3021
  longitude: lnlt[0],
@@ -2692,11 +3025,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2692
3025
  markerContentX: -5.5,
2693
3026
  markerContentY: -12.5
2694
3027
  }
2695
- };
2696
- //用addpoint方法加点
2697
- t.addPoint([point]);
2698
- //缓存点信息
3028
+ }; //用addpoint方法加点
3029
+
3030
+ t.addPoint([point]); //缓存点信息
3031
+
2699
3032
  t.rangingTool.points.push(point);
3033
+
2700
3034
  if (t.rangingTool.line.paths.length == 2) {
2701
3035
  //加线
2702
3036
  t.rangingTool.line = {
@@ -2713,11 +3047,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
2713
3047
  t.updateLine([_objectSpread(_objectSpread({}, t.rangingTool.line), {}, {
2714
3048
  paths: _toConsumableArray(t.rangingTool.line.paths)
2715
3049
  })]);
2716
- }
2717
- //双击 测距结束
3050
+ } //双击 测距结束
3051
+
3052
+
2718
3053
  if (status == 'dbl') {
2719
- var rangkey = new Date().getTime() + Math.random();
2720
- //加结束点
3054
+ var rangkey = new Date().getTime() + Math.random(); //加结束点
3055
+
2721
3056
  var end = {
2722
3057
  id: 'vtx_g_rang_end' + Math.random(),
2723
3058
  longitude: lnlt[0],
@@ -2730,15 +3065,15 @@ var Map = /*#__PURE__*/function (_React$Component) {
2730
3065
  markerContentY: -20
2731
3066
  },
2732
3067
  index: rangkey
2733
- };
2734
- //用addpoint方法加点
2735
- t.addPoint([end]);
2736
- //删除提示框
3068
+ }; //用addpoint方法加点
3069
+
3070
+ t.addPoint([end]); //删除提示框
3071
+
2737
3072
  t.removeGraphic('vtx_g_rang_showRangTool', 'point');
2738
- t.removeGraphic('vtx_g_rang_showRangTool_line', 'line');
2739
- //缓存当前这一条测距数据
2740
- t.rangingTools[rangkey] = _objectSpread({}, t.rangingTool);
2741
- //回调测距参数
3073
+ t.removeGraphic('vtx_g_rang_showRangTool_line', 'line'); //缓存当前这一条测距数据
3074
+
3075
+ t.rangingTools[rangkey] = _objectSpread({}, t.rangingTool); //回调测距参数
3076
+
2742
3077
  if (t.rangingTool.mapRangingTool) {
2743
3078
  t.rangingTool.mapRangingTool({
2744
3079
  distance: t.rangingTool.distance,
@@ -2748,6 +3083,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
2748
3083
  }
2749
3084
  }
2750
3085
  };
3086
+
2751
3087
  if (status !== 'dbl') {
2752
3088
  //100毫秒内点击2次 则结束
2753
3089
  if (!t.rangingTool.isDbclick) {
@@ -2756,9 +3092,11 @@ var Map = /*#__PURE__*/function (_React$Component) {
2756
3092
  if (t.rangingTool.dbclickTimer) {
2757
3093
  clearTimeout(t.rangingTool.dbclickTimer);
2758
3094
  }
3095
+
2759
3096
  t.rangingTool.isDbclick = false;
2760
3097
  t.rangingToolEndFun(e);
2761
3098
  }
3099
+
2762
3100
  t.rangingTool.dbclickTimer = setTimeout(function () {
2763
3101
  fun();
2764
3102
  }, 200);
@@ -2767,20 +3105,23 @@ var Map = /*#__PURE__*/function (_React$Component) {
2767
3105
  }
2768
3106
  };
2769
3107
  }
3108
+
2770
3109
  if (!t.rangingToolMoveFun) {
2771
3110
  t.rangingToolMoveFun = function (e) {
2772
3111
  //获取测距提示点位
2773
- var rp = _objectSpread({}, t.GM.getGraphicParam('vtx_g_rang_showRangTool').attributes);
2774
- //删除多余数据,避免other层级太多
3112
+ var rp = _objectSpread({}, t.GM.getGraphicParam('vtx_g_rang_showRangTool').attributes); //删除多余数据,避免other层级太多
3113
+
3114
+
2775
3115
  delete rp.other;
2776
3116
  var rcontent = rp.markerContent;
3117
+
2777
3118
  if (t.rangingTool.points.length > 0) {
2778
- var distance = t.calculatePointsDistance([e.latLng.lng(), e.latLng.lat()], [t.rangingTool.points[t.rangingTool.points.length - 1].longitude, t.rangingTool.points[t.rangingTool.points.length - 1].latitude], t.state.gis, t.grwkid);
2779
- // 实时计算距离
3119
+ var distance = t.calculatePointsDistance([e.latLng.lng(), e.latLng.lat()], [t.rangingTool.points[t.rangingTool.points.length - 1].longitude, t.rangingTool.points[t.rangingTool.points.length - 1].latitude], t.state.gis, t.grwkid); // 实时计算距离
3120
+
2780
3121
  distance += t.rangingTool.distance;
2781
3122
  var distext = distance > 1000 ? "\u603B\u957F:".concat(Math.round(distance / 10) / 100, "\u516C\u91CC") : "\u603B\u957F:".concat(distance, "\u7C73");
2782
- rcontent = "\n <div class='vtx-g-rang-showRangTool'>\n <div>".concat(distext, "</div>\n <div>\u5355\u51FB\u786E\u5B9A\u5730\u70B9,\u53CC\u51FB\u7ED3\u675F</div>\n </div>\n ");
2783
- //测距移动的线
3123
+ rcontent = "\n <div class='vtx-g-rang-showRangTool'>\n <div>".concat(distext, "</div>\n <div>\u5355\u51FB\u786E\u5B9A\u5730\u70B9,\u53CC\u51FB\u7ED3\u675F</div>\n </div>\n "); //测距移动的线
3124
+
2784
3125
  var sl = {
2785
3126
  id: 'vtx_g_rang_showRangTool_line',
2786
3127
  paths: [[t.rangingTool.points[t.rangingTool.points.length - 1].longitude, t.rangingTool.points[t.rangingTool.points.length - 1].latitude], [e.latLng.lng(), e.latLng.lat()]],
@@ -2791,6 +3132,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
2791
3132
  pellucidity: 0.5
2792
3133
  }
2793
3134
  };
3135
+
2794
3136
  if (!t.GM.getGraphic('vtx_g_rang_showRangTool_line')) {
2795
3137
  t.addLine([sl]);
2796
3138
  t.GM.getGraphic('vtx_g_rang_showRangTool_line').addListener('dblclick', function (e) {
@@ -2800,6 +3142,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
2800
3142
  t.updateLine([sl]);
2801
3143
  }
2802
3144
  }
3145
+
2803
3146
  rp = _objectSpread(_objectSpread({}, rp), {}, {
2804
3147
  longitude: e.latLng.lng(),
2805
3148
  latitude: e.latLng.lat(),
@@ -2808,15 +3151,16 @@ var Map = /*#__PURE__*/function (_React$Component) {
2808
3151
  t.updatePoint([rp], 'nodeg');
2809
3152
  };
2810
3153
  }
3154
+
2811
3155
  if (!t.rangingToolEndFun) {
2812
3156
  t.rangingToolEndFun = function (e) {
2813
- t.state.gis.disableDoubleClickZoom = false;
2814
- //测距完结
3157
+ t.state.gis.disableDoubleClickZoom = false; //测距完结
3158
+
2815
3159
  if (t.rangingTool.isRanging) {
2816
3160
  if (t.rangingTool.points.length > 0) {
2817
3161
  //处理点击和双击事件逻辑
2818
- t.rangingToolFun(e, 'dbl');
2819
- //回调测距参数
3162
+ t.rangingToolFun(e, 'dbl'); //回调测距参数
3163
+
2820
3164
  if (t.rangingTool.mapRangingTool) {
2821
3165
  t.rangingTool.mapRangingTool({
2822
3166
  distance: t.rangingTool.distance,
@@ -2826,13 +3170,15 @@ var Map = /*#__PURE__*/function (_React$Component) {
2826
3170
  } else {
2827
3171
  //删除提示框
2828
3172
  t.removeGraphic('vtx_g_rang_showRangTool', 'point');
2829
- }
2830
- //关闭监听事件
3173
+ } //关闭监听事件
3174
+
3175
+
2831
3176
  for (var i in t.rangingTool.eventList) {
2832
3177
  if (t.rangingTool.eventList[i]) {
2833
3178
  t.rangingTool.eventList[i].remove();
2834
3179
  }
2835
3180
  }
3181
+
2836
3182
  t.rangingTool = _objectSpread(_objectSpread({}, t.rangingTool), {}, {
2837
3183
  isRanging: false,
2838
3184
  //是否开启状态
@@ -2850,16 +3196,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
2850
3196
  t.state.gis.draggableCursor = 'url("http://maps.gstatic.cn/mapfiles/openhand_8_8.cur"), default';
2851
3197
  }
2852
3198
  };
2853
- }
2854
- //避免鼠标在图元上 测距工具不起作用
3199
+ } //避免鼠标在图元上 测距工具不起作用
3200
+
3201
+
2855
3202
  gids.forEach(function (item) {
2856
3203
  t.rangingTool.eventList[item] = t.GM.getGraphic(item).addListener('mousemove', function (e) {
2857
3204
  if (t.rangingTool.isRanging && t.rangingToolMoveFun) {
2858
3205
  t.rangingToolMoveFun(e);
2859
3206
  }
2860
3207
  });
2861
- });
2862
- //地图鼠标移入事件
3208
+ }); //地图鼠标移入事件
3209
+
2863
3210
  t.rangingTool.eventList['mouseover'] = t.state.gis.addListener('mouseover', function (e) {
2864
3211
  //鼠标移出地图时,删除测距显示点
2865
3212
  if (t.rangingTool.isRanging) {
@@ -2875,57 +3222,61 @@ var Map = /*#__PURE__*/function (_React$Component) {
2875
3222
  };
2876
3223
  t.addPoint([rp], 'nodeg');
2877
3224
  }
2878
- });
2879
- //地图鼠标移出事件
3225
+ }); //地图鼠标移出事件
3226
+
2880
3227
  t.rangingTool.eventList['mouseout'] = t.state.gis.addListener('mouseout', function (e) {
2881
3228
  //鼠标移出地图时,删除测距显示点
2882
3229
  if (t.rangingTool.isRanging) {
2883
3230
  t.removeGraphic('vtx_g_rang_showRangTool', 'point');
2884
3231
  }
2885
- });
2886
- //地图鼠标移动事件
3232
+ }); //地图鼠标移动事件
3233
+
2887
3234
  t.rangingTool.eventList['mousemove'] = t.state.gis.addListener('mousemove', function (e) {
2888
3235
  //鼠标移动地图时,删除测距显示点
2889
3236
  if (t.rangingTool.isRanging && t.rangingToolMoveFun) {
2890
3237
  t.rangingToolMoveFun(e);
2891
3238
  }
2892
- });
2893
- //双击事件
3239
+ }); //双击事件
3240
+
2894
3241
  t.rangingTool.eventList['dblclick'] = t.state.gis.addListener('dblclick', function (e) {
2895
3242
  t.rangingToolEndFun(e);
2896
3243
  });
2897
- }
2898
- //聚合地图图元(arg为空时聚合全部点)
3244
+ } //聚合地图图元(arg为空时聚合全部点)
3245
+
2899
3246
  }, {
2900
3247
  key: "cluster",
2901
3248
  value: function cluster(arg) {
2902
3249
  var t = this;
2903
3250
  var ary = t.clusterToolFunction(arg);
3251
+
2904
3252
  t._cluster.addMarkers(ary);
2905
- }
2906
- //删除点聚合效果
3253
+ } //删除点聚合效果
3254
+
2907
3255
  }, {
2908
3256
  key: "removeCluster",
2909
3257
  value: function removeCluster(arg) {
2910
3258
  var t = this;
2911
3259
  var ary = t.clusterToolFunction(arg);
3260
+
2912
3261
  if (ary.length > 0) {
2913
3262
  t._cluster.removeMarkers(ary);
2914
3263
  }
2915
- }
2916
- //清空聚合效果
3264
+ } //清空聚合效果
3265
+
2917
3266
  }, {
2918
3267
  key: "clearClusters",
2919
3268
  value: function clearClusters() {
2920
3269
  var t = this;
3270
+
2921
3271
  t._cluster.clearMarkers();
2922
- }
2923
- //聚合功能公共方法(获取图元集合)
3272
+ } //聚合功能公共方法(获取图元集合)
3273
+
2924
3274
  }, {
2925
3275
  key: "clusterToolFunction",
2926
3276
  value: function clusterToolFunction(arg) {
2927
3277
  var t = this;
2928
3278
  var ary = [];
3279
+
2929
3280
  if (!arg) {
2930
3281
  var pointIds = t.state.pointIds;
2931
3282
  ary = pointIds.filter(function (item, index) {
@@ -2938,26 +3289,31 @@ var Map = /*#__PURE__*/function (_React$Component) {
2938
3289
  ary = arg.split(',');
2939
3290
  }
2940
3291
  }
2941
- t.clusterIdList = ary;
2942
- //过滤moveTo的点位
3292
+
3293
+ t.clusterIdList = ary; //过滤moveTo的点位
2943
3294
  //缓存所有聚合的点位
3295
+
2944
3296
  var allps = [];
3297
+
2945
3298
  for (var i = 0; i < ary.length; i++) {
2946
3299
  var gc = t.GM.getGraphic(ary[i]);
2947
- allps.push(gc);
2948
- //加入label图元
3300
+ allps.push(gc); //加入label图元
3301
+
2949
3302
  if (gc.ishaveLabel) {
2950
3303
  allps.push(t.GM.getGraphic("".concat(ary[i], "_vtxoMap_label")));
2951
3304
  }
2952
3305
  }
3306
+
2953
3307
  return allps;
2954
3308
  }
2955
3309
  /*地图事件处理*/
2956
3310
  //地图点击事件
3311
+
2957
3312
  }, {
2958
3313
  key: "clickMap",
2959
3314
  value: function clickMap() {
2960
3315
  var t = this;
3316
+
2961
3317
  if (typeof t.props.clickMap === "function") {
2962
3318
  t.state.gis.addListener('click', function (e) {
2963
3319
  //测距点击事件
@@ -2975,12 +3331,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
2975
3331
  }
2976
3332
  });
2977
3333
  }
2978
- }
2979
- //地图拖动之前事件
3334
+ } //地图拖动之前事件
3335
+
2980
3336
  }, {
2981
3337
  key: "dragMapStart",
2982
3338
  value: function dragMapStart() {
2983
3339
  var t = this;
3340
+
2984
3341
  if (typeof t.props.dragMapStart === 'function') {
2985
3342
  t.state.gis.addListener('dragstart', function (e) {
2986
3343
  var obj = t.getMapExtent();
@@ -2988,12 +3345,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
2988
3345
  t.props.dragMapStart(obj);
2989
3346
  });
2990
3347
  }
2991
- }
2992
- //地图拖动结束后事件
3348
+ } //地图拖动结束后事件
3349
+
2993
3350
  }, {
2994
3351
  key: "dragMapEnd",
2995
3352
  value: function dragMapEnd() {
2996
3353
  var t = this;
3354
+
2997
3355
  if (typeof t.props.dragMapEnd === 'function') {
2998
3356
  t.state.gis.addListener('dragend', function (e) {
2999
3357
  var obj = t.getMapExtent();
@@ -3001,20 +3359,22 @@ var Map = /*#__PURE__*/function (_React$Component) {
3001
3359
  t.props.dragMapEnd(obj);
3002
3360
  });
3003
3361
  }
3004
- }
3005
- //地图移动之前事件
3362
+ } //地图移动之前事件
3363
+
3006
3364
  }, {
3007
3365
  key: "moveStart",
3008
3366
  value: function moveStart() {
3009
3367
  var t = this;
3368
+
3010
3369
  if (typeof t.props.moveStart === 'function') {
3011
3370
  t.state.gis.addListener('bounds_changed', function (e) {
3012
3371
  if (t.pointCollectionId) {
3013
3372
  $("#".concat(t.pointCollectionId)).css({
3014
3373
  visibility: 'hidden'
3015
3374
  });
3016
- }
3017
- //区别是否在移动状态
3375
+ } //区别是否在移动状态
3376
+
3377
+
3018
3378
  if (!t.isZoomming && !t.isMoving) {
3019
3379
  if (t.oldZoomLevel == t.state.gis.getZoom()) {
3020
3380
  t.isMoving = true;
@@ -3025,12 +3385,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
3025
3385
  }
3026
3386
  });
3027
3387
  }
3028
- }
3029
- //google地图没有move事件和zoomEnd事件,通过模拟实现
3388
+ } //google地图没有move事件和zoomEnd事件,通过模拟实现
3389
+
3030
3390
  }, {
3031
3391
  key: "moveEndAndZoomEnd",
3032
3392
  value: function moveEndAndZoomEnd() {
3033
3393
  var t = this;
3394
+
3034
3395
  if (typeof t.props.moveEnd === 'function' || typeof t.props.zoomEnd === 'function' || typeof t.props.moveStart === 'function' || typeof t.props.zoomStart === 'function') {
3035
3396
  t.state.gis.addListener('idle', function (e) {
3036
3397
  if (t.pointCollectionId) {
@@ -3038,17 +3399,21 @@ var Map = /*#__PURE__*/function (_React$Component) {
3038
3399
  visibility: 'inherit'
3039
3400
  });
3040
3401
  }
3402
+
3041
3403
  var obj = t.getMapExtent();
3042
- obj.e = e;
3043
- //区别是否在移动状态-同时判断是moveEnd还是zoomEnd
3404
+ obj.e = e; //区别是否在移动状态-同时判断是moveEnd还是zoomEnd
3405
+
3044
3406
  if (t.isMoving) {
3045
3407
  t.isMoving = false;
3046
3408
  }
3409
+
3047
3410
  if (t.isZoomming) {
3048
3411
  t.isZoomming = false;
3049
3412
  }
3413
+
3050
3414
  if (t.oldZoomLevel != t.state.gis.getZoom()) {
3051
3415
  t.oldZoomLevel = t.state.gis.getZoom();
3416
+
3052
3417
  if (typeof t.props.zoomEnd === 'function') {
3053
3418
  t.props.zoomEnd(obj);
3054
3419
  }
@@ -3056,19 +3421,21 @@ var Map = /*#__PURE__*/function (_React$Component) {
3056
3421
  if (typeof t.props.moveEnd === 'function') {
3057
3422
  t.props.moveEnd(obj);
3058
3423
  }
3059
- }
3060
- //更新海量点
3424
+ } //更新海量点
3425
+
3426
+
3061
3427
  if (t.props.mapPointCollection) {
3062
3428
  t.updatePointCollection(t.props.mapPointCollection);
3063
3429
  }
3064
3430
  });
3065
3431
  }
3066
- }
3067
- //地图更改缩放级别开始时触发触发此事件
3432
+ } //地图更改缩放级别开始时触发触发此事件
3433
+
3068
3434
  }, {
3069
3435
  key: "zoomStart",
3070
3436
  value: function zoomStart() {
3071
3437
  var t = this;
3438
+
3072
3439
  if (typeof t.props.zoomStart === 'function') {
3073
3440
  t.state.gis.addListener('zoom_changed', function (e) {
3074
3441
  if (t.pointCollectionId) {
@@ -3076,6 +3443,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
3076
3443
  visibility: 'hidden'
3077
3444
  });
3078
3445
  }
3446
+
3079
3447
  if (!t.isZoomming) {
3080
3448
  t.isZoomming = true;
3081
3449
  var obj = t.getMapExtent();
@@ -3084,44 +3452,51 @@ var Map = /*#__PURE__*/function (_React$Component) {
3084
3452
  }
3085
3453
  });
3086
3454
  }
3087
- }
3088
- //对外使用方法
3455
+ } //对外使用方法
3089
3456
  //显示隐藏的图元
3457
+
3090
3458
  }, {
3091
3459
  key: "showGraphicById",
3092
3460
  value: function showGraphicById(id) {
3093
3461
  var t = this;
3462
+
3094
3463
  if (t.GM.getGraphic(id)) {
3095
3464
  t.GM.getGraphic(id).setVisible(true);
3096
3465
  }
3097
- }
3098
- //隐藏图元
3466
+ } //隐藏图元
3467
+
3099
3468
  }, {
3100
3469
  key: "hideGraphicById",
3101
3470
  value: function hideGraphicById(id) {
3102
3471
  var t = this;
3472
+
3103
3473
  if (t.GM.getGraphic(id)) {
3104
3474
  t.GM.getGraphic(id).hide(false);
3105
3475
  }
3106
- }
3107
- //内部公共方法区
3476
+ } //内部公共方法区
3108
3477
  //获取图元数据
3478
+
3109
3479
  }, {
3110
3480
  key: "getGraphic",
3111
3481
  value: function getGraphic(id) {
3112
3482
  var t = this;
3483
+
3113
3484
  if (!id) {
3114
3485
  return false;
3115
3486
  }
3487
+
3116
3488
  var gp = t.GM.getGraphicParam(id);
3117
3489
  var gg = t.GM.getGraphic(id);
3490
+
3118
3491
  if (!gg) {
3119
3492
  return false;
3120
3493
  }
3494
+
3121
3495
  var p = {},
3122
- pts = [],
3123
- lng = 0,
3124
- lat = 0;
3496
+ pts = [],
3497
+ lng = 0,
3498
+ lat = 0;
3499
+
3125
3500
  switch (gp.geometryType) {
3126
3501
  case 'point':
3127
3502
  lng = gg.getPosition().lng();
@@ -3142,6 +3517,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
3142
3517
  })
3143
3518
  });
3144
3519
  break;
3520
+
3145
3521
  case 'polyline':
3146
3522
  pts = gg.getPath().getArray().map(function (item, index) {
3147
3523
  return [item.lng(), item.lat()];
@@ -3159,6 +3535,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
3159
3535
  })
3160
3536
  });
3161
3537
  break;
3538
+
3162
3539
  case 'polygon':
3163
3540
  pts = gg.getPath().getArray().map(function (item, index) {
3164
3541
  return [item.lng(), item.lat()];
@@ -3176,6 +3553,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
3176
3553
  })
3177
3554
  });
3178
3555
  break;
3556
+
3179
3557
  case 'circle':
3180
3558
  lng = gg.getCenter().lng();
3181
3559
  lat = gg.getCenter().lat();
@@ -3200,9 +3578,10 @@ var Map = /*#__PURE__*/function (_React$Component) {
3200
3578
  });
3201
3579
  break;
3202
3580
  }
3581
+
3203
3582
  return p;
3204
- }
3205
- //获取地图当前的位置状态信息
3583
+ } //获取地图当前的位置状态信息
3584
+
3206
3585
  }, {
3207
3586
  key: "getMapExtent",
3208
3587
  value: function getMapExtent() {
@@ -3225,44 +3604,50 @@ var Map = /*#__PURE__*/function (_React$Component) {
3225
3604
  };
3226
3605
  obj.radius = t.calculatePointsDistance([obj.nowCenter.lng(), obj.nowCenter.lat()], [obj.northEast.lng, obj.northEast.lat]);
3227
3606
  return obj;
3228
- }
3229
- //获取当前比例尺
3607
+ } //获取当前比例尺
3608
+
3230
3609
  }, {
3231
3610
  key: "getZoomLevel",
3232
3611
  value: function getZoomLevel() {
3233
3612
  var t = this;
3234
3613
  return t.state.gis.getZoom();
3235
- }
3236
- //处理线和面的 经纬度数据
3614
+ } //处理线和面的 经纬度数据
3615
+
3237
3616
  }, {
3238
3617
  key: "dealData",
3239
3618
  value: function dealData(ms) {
3240
3619
  //区别点和圆的经纬度数据处理
3241
3620
  var lnglatAry = [],
3242
- _extent = {
3243
- xmax: 0,
3244
- xmin: 0,
3245
- ymax: 0,
3246
- ymin: 0
3247
- },
3248
- path = [];
3621
+ _extent = {
3622
+ xmax: 0,
3623
+ xmin: 0,
3624
+ ymax: 0,
3625
+ ymin: 0
3626
+ },
3627
+ path = [];
3628
+
3249
3629
  if ('getPath' in ms) {
3250
3630
  path = ms.getPath().getArray();
3251
3631
  path = path.map(function (item, index) {
3252
3632
  var lng = item.lng(),
3253
- lat = item.lat();
3633
+ lat = item.lat();
3634
+
3254
3635
  if (lng > _extent.xmax) {
3255
3636
  _extent.xmax = lng;
3256
3637
  }
3638
+
3257
3639
  if (lng < _extent.xmin || _extent.xmin == 0) {
3258
3640
  _extent.xmin = lng;
3259
3641
  }
3642
+
3260
3643
  if (lat > _extent.ymax) {
3261
3644
  _extent.ymax = lat;
3262
3645
  }
3646
+
3263
3647
  if (lat < _extent.ymin || _extent.ymin == 0) {
3264
3648
  _extent.ymin = lat;
3265
3649
  }
3650
+
3266
3651
  lnglatAry.push({
3267
3652
  lngX: lng,
3268
3653
  latX: lat
@@ -3270,122 +3655,142 @@ var Map = /*#__PURE__*/function (_React$Component) {
3270
3655
  return [lng, lat];
3271
3656
  });
3272
3657
  }
3658
+
3273
3659
  return {
3274
3660
  lnglatAry: lnglatAry,
3275
3661
  _extent: _extent,
3276
3662
  path: path
3277
3663
  };
3278
- }
3279
- //点位移动动画效果
3664
+ } //点位移动动画效果
3665
+
3280
3666
  }, {
3281
3667
  key: "moveAnimation",
3282
3668
  value: function moveAnimation() {
3283
3669
  var t = this;
3670
+
3284
3671
  if (t.moveToTimer) {
3285
3672
  clearInterval(t.moveToTimer);
3286
3673
  }
3674
+
3287
3675
  t.moveToTimer = setInterval(function () {
3288
3676
  for (var i = 0; i < t.movePoints.length; i++) {
3289
3677
  t.movePoints[i].waitTime += 10;
3290
3678
  t.movePoints[i].deleteTime -= 10;
3291
3679
  }
3680
+
3292
3681
  t.movePoints.sort(function (x, y) {
3293
3682
  return y.waitTime - x.waitTime;
3294
3683
  });
3295
3684
  var nowMovePoints = t.movePoints.slice(0, 10),
3296
- deleteIndex = [];
3685
+ deleteIndex = [];
3686
+
3297
3687
  for (var _i3 = 0; _i3 < nowMovePoints.length; _i3++) {
3298
3688
  var _nowMovePoints$_i = nowMovePoints[_i3],
3299
- id = _nowMovePoints$_i.id,
3300
- rx = _nowMovePoints$_i.rx,
3301
- ry = _nowMovePoints$_i.ry,
3302
- waitTime = _nowMovePoints$_i.waitTime,
3303
- deleteTime = _nowMovePoints$_i.deleteTime;
3689
+ id = _nowMovePoints$_i.id,
3690
+ rx = _nowMovePoints$_i.rx,
3691
+ ry = _nowMovePoints$_i.ry,
3692
+ waitTime = _nowMovePoints$_i.waitTime,
3693
+ deleteTime = _nowMovePoints$_i.deleteTime;
3304
3694
  var gc = t.GM.getGraphic(id),
3305
- gc_label = t.GM.getGraphic("".concat(id, "_vtxoMap_label"));
3695
+ gc_label = t.GM.getGraphic("".concat(id, "_vtxoMap_label"));
3696
+
3306
3697
  if (!gc) {
3307
3698
  clearInterval(t.moveToTimer);
3308
3699
  } else {
3309
3700
  if (gc.isAdded) {
3310
3701
  t._cluster.removeMarker(gc);
3311
3702
  }
3703
+
3312
3704
  if (gc_label && gc_label.isAdded) {
3313
3705
  t._cluster.removeMarker(gc_label);
3314
3706
  }
3707
+
3315
3708
  var gg = gc.getPosition();
3316
3709
  var tx = gg.lng() + rx,
3317
- ty = gg.lat() + ry;
3710
+ ty = gg.lat() + ry;
3318
3711
  gc.setPosition(new t.omap.LatLng({
3319
3712
  lng: tx,
3320
3713
  lat: ty
3321
3714
  }));
3715
+
3322
3716
  if (gc_label) {
3323
3717
  gc_label.setPosition(new t.omap.LatLng({
3324
3718
  lng: tx,
3325
3719
  lat: ty
3326
3720
  }));
3327
3721
  }
3722
+
3328
3723
  t.movePoints[_i3].waitTime = 0;
3724
+
3329
3725
  if (deleteTime <= 0) {
3330
3726
  deleteIndex.push(_i3);
3331
3727
  }
3332
3728
  }
3333
3729
  }
3730
+
3334
3731
  deleteIndex.sort(function (a, b) {
3335
3732
  return b - a;
3336
3733
  });
3734
+
3337
3735
  for (var _i4 = 0; _i4 < deleteIndex.length; _i4++) {
3338
3736
  var _t$movePoints$deleteI = t.movePoints[deleteIndex[_i4]],
3339
- _id = _t$movePoints$deleteI.id,
3340
- _rx = _t$movePoints$deleteI.rx,
3341
- _ry = _t$movePoints$deleteI.ry,
3342
- _waitTime = _t$movePoints$deleteI.waitTime,
3343
- _deleteTime = _t$movePoints$deleteI.deleteTime,
3344
- _gc = t.GM.getGraphic(_id),
3345
- _gc_label = t.GM.getGraphic("".concat(_id, "_vtxoMap_label"));
3737
+ _id = _t$movePoints$deleteI.id,
3738
+ _rx = _t$movePoints$deleteI.rx,
3739
+ _ry = _t$movePoints$deleteI.ry,
3740
+ _waitTime = _t$movePoints$deleteI.waitTime,
3741
+ _deleteTime = _t$movePoints$deleteI.deleteTime,
3742
+ _gc = t.GM.getGraphic(_id),
3743
+ _gc_label = t.GM.getGraphic("".concat(_id, "_vtxoMap_label"));
3744
+
3346
3745
  if (t.clusterIdList.indexOf(_id) > -1) {
3347
3746
  t._cluster.addMarker(_gc);
3747
+
3348
3748
  if (_gc_label) {
3349
3749
  t._cluster.addMarker(_gc_label);
3350
3750
  }
3351
3751
  }
3752
+
3352
3753
  t.movePoints.splice(deleteIndex[_i4], 1);
3353
3754
  }
3755
+
3354
3756
  if (nowMovePoints.length == 0) {
3355
3757
  clearInterval(t.moveToTimer);
3356
3758
  }
3357
3759
  }, 10);
3358
- }
3359
- //点位移动逻辑
3760
+ } //点位移动逻辑
3761
+
3360
3762
  }, {
3361
3763
  key: "moveTo",
3362
3764
  value: function moveTo(id, lnglat, delay, autoRotation, urlright, urlleft) {
3363
3765
  var t = this,
3364
- timer = 10,
3365
- gc = t.GM.getGraphic(id);
3766
+ timer = 10,
3767
+ gc = t.GM.getGraphic(id);
3366
3768
  delay = eval(delay || 3) * 1000;
3367
3769
  var count = delay / timer;
3368
3770
  var s = gc.getPosition(),
3369
- e = new t.omap.LatLng({
3370
- lng: lnglat[0],
3371
- lat: lnglat[1]
3372
- });
3771
+ e = new t.omap.LatLng({
3772
+ lng: lnglat[0],
3773
+ lat: lnglat[1]
3774
+ });
3775
+
3373
3776
  if (s.equals(e)) {
3374
3777
  return false;
3375
3778
  } else {
3376
- var url = null;
3377
- //计算角度,旋转
3779
+ var url = null; //计算角度,旋转
3780
+
3378
3781
  if (autoRotation && !gc.isMarkerContent) {
3379
3782
  var ddeg = t.rotateDeg(s, e);
3783
+
3380
3784
  if (urlleft && ddeg < -90 && ddeg > -270) {
3381
3785
  ddeg += 180;
3382
3786
  url = urlleft;
3383
3787
  } else {
3384
3788
  url = urlright;
3385
3789
  }
3790
+
3386
3791
  var icon = gc.getIcon(),
3387
- iconUrl = '';
3388
- // 360deg 不需要旋转
3792
+ iconUrl = ''; // 360deg 不需要旋转
3793
+
3389
3794
  if (ddeg % 360 != 0) {
3390
3795
  iconUrl = new _MapToolFunction.RotateIcon({
3391
3796
  url: url,
@@ -3393,14 +3798,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
3393
3798
  height: icon.size.height
3394
3799
  });
3395
3800
  }
3801
+
3396
3802
  gc.setIcon(_objectSpread(_objectSpread({}, icon), {}, {
3397
3803
  url: iconUrl.setRotation(ddeg).getUrl()
3398
3804
  }));
3399
- }
3400
- //拆分延迟移动定位
3805
+ } //拆分延迟移动定位
3806
+
3807
+
3401
3808
  var rx = (e.lng() - s.lng()) / count,
3402
- ry = (e.lat() - s.lat()) / count;
3809
+ ry = (e.lat() - s.lat()) / count;
3403
3810
  var isHave = false;
3811
+
3404
3812
  for (var i = 0; i < t.movePoints.length; i++) {
3405
3813
  if (t.movePoints[i].id == id) {
3406
3814
  t.movePoints.splice(i, 1, {
@@ -3413,6 +3821,7 @@ var Map = /*#__PURE__*/function (_React$Component) {
3413
3821
  isHave = true;
3414
3822
  }
3415
3823
  }
3824
+
3416
3825
  if (!isHave) {
3417
3826
  t.movePoints.push({
3418
3827
  id: id,
@@ -3423,16 +3832,17 @@ var Map = /*#__PURE__*/function (_React$Component) {
3423
3832
  });
3424
3833
  }
3425
3834
  }
3426
- }
3427
- //点位角度旋转(以指向东(右)为0°)
3835
+ } //点位角度旋转(以指向东(右)为0°)
3836
+
3428
3837
  }, {
3429
3838
  key: "rotateDeg",
3430
3839
  value: function rotateDeg(sp, ep) {
3431
3840
  var t = this,
3432
- deg = 0,
3433
- ftp = t.canvasProjectionOverlay.getProjection(),
3434
- spLngLat = sp,
3435
- epLngLat = ep;
3841
+ deg = 0,
3842
+ ftp = t.canvasProjectionOverlay.getProjection(),
3843
+ spLngLat = sp,
3844
+ epLngLat = ep;
3845
+
3436
3846
  if (ftp) {
3437
3847
  if (Array.isArray(sp)) {
3438
3848
  spLngLat = new t.omap.LatLng({
@@ -3440,25 +3850,29 @@ var Map = /*#__PURE__*/function (_React$Component) {
3440
3850
  lat: sp[1]
3441
3851
  });
3442
3852
  }
3853
+
3443
3854
  if (Array.isArray(ep)) {
3444
3855
  spLngLat = new t.omap.LatLng({
3445
3856
  lng: ep[0],
3446
3857
  lat: ep[1]
3447
3858
  });
3448
3859
  }
3860
+
3449
3861
  var s = ftp.fromLatLngToContainerPixel(spLngLat),
3450
- //获取当前点位的经纬度
3451
- e = ftp.fromLatLngToContainerPixel(epLngLat);
3862
+ //获取当前点位的经纬度
3863
+ e = ftp.fromLatLngToContainerPixel(epLngLat);
3864
+
3452
3865
  if (e.x != s.x) {
3453
3866
  var tan = (e.y - s.y) / (e.x - s.x),
3454
- atan = Math.atan(tan);
3455
- deg = atan * 360 / (2 * Math.PI);
3456
- //degree correction;
3867
+ atan = Math.atan(tan);
3868
+ deg = atan * 360 / (2 * Math.PI); //degree correction;
3869
+
3457
3870
  if (e.x < s.x) {
3458
3871
  deg = -deg + 90 + 90;
3459
3872
  } else {
3460
3873
  deg = -deg;
3461
3874
  }
3875
+
3462
3876
  deg = -deg;
3463
3877
  } else {
3464
3878
  var disy = e.y - s.y;
@@ -3468,35 +3882,43 @@ var Map = /*#__PURE__*/function (_React$Component) {
3468
3882
  deg = -bias * 90;
3469
3883
  }
3470
3884
  }
3885
+
3471
3886
  return deg;
3472
3887
  }
3473
3888
  /*
3474
3889
  匹配控件位置方法
3475
3890
  (谷歌地图有8个方位,为了统一,只使用左上,左下,右上,右下)
3476
3891
  */
3892
+
3477
3893
  }, {
3478
3894
  key: "matchControlPosition",
3479
3895
  value: function matchControlPosition(location) {
3480
3896
  var position = google.maps.ControlPosition.RIGHT_BOTTOM;
3897
+
3481
3898
  switch (location) {
3482
3899
  case 'tl':
3483
3900
  position = google.maps.ControlPosition.LEFT_TOP;
3484
3901
  break;
3902
+
3485
3903
  case 'bl':
3486
3904
  position = google.maps.ControlPosition.LEFT_BOTTOM;
3487
3905
  break;
3906
+
3488
3907
  case 'tr':
3489
3908
  position = google.maps.ControlPosition.RIGHT_TOP;
3490
3909
  break;
3910
+
3491
3911
  case 'br':
3492
3912
  position = google.maps.ControlPosition.RIGHT_BOTTOM;
3493
3913
  break;
3494
3914
  }
3915
+
3495
3916
  return position;
3496
3917
  }
3497
3918
  /*
3498
3919
  地图内部需要公共方法
3499
3920
  */
3921
+
3500
3922
  }, {
3501
3923
  key: "calculatePointsDistance",
3502
3924
  value: function calculatePointsDistance(fp, ep) {
@@ -3509,45 +3931,49 @@ var Map = /*#__PURE__*/function (_React$Component) {
3509
3931
  lat: ep[1]
3510
3932
  })) * 100) / 100;
3511
3933
  }
3934
+
3512
3935
  return 0;
3513
- }
3514
- //计算多个点的距离(常用于线计算)
3936
+ } //计算多个点的距离(常用于线计算)
3937
+
3515
3938
  }, {
3516
3939
  key: "calculateDistance",
3517
3940
  value: function calculateDistance(ps) {
3518
3941
  var t = this,
3519
- totalDistance = 0;
3942
+ totalDistance = 0;
3943
+
3520
3944
  if (ps.length < 0) {
3521
3945
  return false;
3522
3946
  }
3947
+
3523
3948
  for (var i = 0; i < ps.length; i++) {
3524
3949
  if (i < ps.length - 1) {
3525
3950
  totalDistance += t.calculatePointsDistance(ps[i], ps[i + 1]);
3526
3951
  }
3527
3952
  }
3953
+
3528
3954
  return Math.round(totalDistance * 100) / 100;
3529
- }
3530
- //计算图元面积(面,圆)
3955
+ } //计算图元面积(面,圆)
3956
+
3531
3957
  }, {
3532
3958
  key: "calculateArea",
3533
3959
  value: function calculateArea(id) {
3534
3960
  var t = this;
3535
3961
  return google.maps.geometry.spherical.computeArea(t.GM.getGraphic(id).getPath().getArray());
3536
- }
3537
- //计算多个点的距离(常用于线计算)[入参是 google 经纬度对象数组]
3962
+ } //计算多个点的距离(常用于线计算)[入参是 google 经纬度对象数组]
3963
+
3538
3964
  }, {
3539
3965
  key: "calculateGraphicDistance",
3540
3966
  value: function calculateGraphicDistance(ary) {
3541
3967
  var t = this;
3542
3968
  return google.maps.geometry.spherical.computeLength(ary);
3543
- }
3544
- //对比对象数据是否相等
3969
+ } //对比对象数据是否相等
3970
+
3545
3971
  }, {
3546
3972
  key: "deepEqual",
3547
3973
  value: function deepEqual(a, b) {
3548
3974
  return _immutable["default"].is(_immutable["default"].fromJS(a), _immutable["default"].fromJS(b));
3549
- }
3550
- //数据解析(分析,新增,更新,删除对应的数据)
3975
+ } //数据解析(分析,新增,更新,删除对应的数据)
3976
+
3551
3977
  }, {
3552
3978
  key: "dataMatch",
3553
3979
  value: function dataMatch(oldData, newData, type) {
@@ -3578,13 +4004,14 @@ var Map = /*#__PURE__*/function (_React$Component) {
3578
4004
  updatedData: updatedData,
3579
4005
  replacedData: replacedData
3580
4006
  };
3581
- }
3582
- //处理需要增加图元的数据(避免意外问题)
4007
+ } //处理需要增加图元的数据(避免意外问题)
4008
+
3583
4009
  }, {
3584
4010
  key: "dealAdd",
3585
4011
  value: function dealAdd(ary, ids) {
3586
4012
  var ads = [],
3587
- otherupds = [];
4013
+ otherupds = [];
4014
+
3588
4015
  for (var i = 0; i < ary.length; i++) {
3589
4016
  if (ids.indexOf(ary[i].id) > -1) {
3590
4017
  otherupds.push(ary[i]);
@@ -3592,17 +4019,19 @@ var Map = /*#__PURE__*/function (_React$Component) {
3592
4019
  ads.push(ary[i]);
3593
4020
  }
3594
4021
  }
4022
+
3595
4023
  return {
3596
4024
  ads: ads,
3597
4025
  otherupds: otherupds
3598
4026
  };
3599
- }
3600
- //处理需要更新图元的数据(避免意外问题)
4027
+ } //处理需要更新图元的数据(避免意外问题)
4028
+
3601
4029
  }, {
3602
4030
  key: "dealUpdate",
3603
4031
  value: function dealUpdate(ary, ids) {
3604
4032
  var upds = [],
3605
- otherads = [];
4033
+ otherads = [];
4034
+
3606
4035
  for (var i = 0; i < ary.length; i++) {
3607
4036
  if (ids.indexOf(ary[i].id) > -1) {
3608
4037
  upds.push(ary[i]);
@@ -3610,12 +4039,13 @@ var Map = /*#__PURE__*/function (_React$Component) {
3610
4039
  otherads.push(ary[i]);
3611
4040
  }
3612
4041
  }
4042
+
3613
4043
  return {
3614
4044
  upds: upds,
3615
4045
  otherads: otherads
3616
4046
  };
3617
- }
3618
- //渲染
4047
+ } //渲染
4048
+
3619
4049
  }, {
3620
4050
  key: "render",
3621
4051
  value: function render() {
@@ -3628,8 +4058,8 @@ var Map = /*#__PURE__*/function (_React$Component) {
3628
4058
  height: '100%'
3629
4059
  }
3630
4060
  });
3631
- }
3632
- //初始化
4061
+ } //初始化
4062
+
3633
4063
  }, {
3634
4064
  key: "componentDidMount",
3635
4065
  value: function componentDidMount() {
@@ -3639,81 +4069,82 @@ var Map = /*#__PURE__*/function (_React$Component) {
3639
4069
  t.mapTop = document.getElementById(t.props.mapId).offsetTop;
3640
4070
  t.init();
3641
4071
  });
3642
- }
3643
- //重新渲染结束
4072
+ } //重新渲染结束
4073
+
3644
4074
  }, {
3645
4075
  key: "componentDidUpdate",
3646
- value: function componentDidUpdate(prevProps, prevState) {}
3647
- //已加载组件,收到新的参数时调用
4076
+ value: function componentDidUpdate(prevProps, prevState) {} //已加载组件,收到新的参数时调用
4077
+
3648
4078
  }, {
3649
4079
  key: "componentWillReceiveProps",
3650
4080
  value: function componentWillReceiveProps(nextProps) {
3651
- var t = this;
3652
- //点/线旧数据
4081
+ var t = this; //点/线旧数据
4082
+
3653
4083
  var _t$state3 = t.state,
3654
- pointIds = _t$state3.pointIds,
3655
- lineIds = _t$state3.lineIds,
3656
- polygonIds = _t$state3.polygonIds,
3657
- circleIds = _t$state3.circleIds,
3658
- drawIds = _t$state3.drawIds;
4084
+ pointIds = _t$state3.pointIds,
4085
+ lineIds = _t$state3.lineIds,
4086
+ polygonIds = _t$state3.polygonIds,
4087
+ circleIds = _t$state3.circleIds,
4088
+ drawIds = _t$state3.drawIds;
3659
4089
  var point = drawIds.point,
3660
- polyline = drawIds.polyline,
3661
- polygon = drawIds.polygon,
3662
- circle = drawIds.circle,
3663
- rectangle = drawIds.rectangle;
3664
- //点/线新数据
4090
+ polyline = drawIds.polyline,
4091
+ polygon = drawIds.polygon,
4092
+ circle = drawIds.circle,
4093
+ rectangle = drawIds.rectangle; //点/线新数据
4094
+
3665
4095
  var _nextProps$mapPoints = nextProps.mapPoints,
3666
- mapPoints = _nextProps$mapPoints === void 0 ? [] : _nextProps$mapPoints,
3667
- _nextProps$mapLines = nextProps.mapLines,
3668
- mapLines = _nextProps$mapLines === void 0 ? [] : _nextProps$mapLines,
3669
- _nextProps$mapPolygon = nextProps.mapPolygons,
3670
- mapPolygons = _nextProps$mapPolygon === void 0 ? [] : _nextProps$mapPolygon,
3671
- _nextProps$mapCircles = nextProps.mapCircles,
3672
- mapCircles = _nextProps$mapCircles === void 0 ? [] : _nextProps$mapCircles,
3673
- _nextProps$customized = nextProps.customizedBoundary,
3674
- customizedBoundary = _nextProps$customized === void 0 ? [] : _nextProps$customized,
3675
- isOpenTrafficInfo = nextProps.isOpenTrafficInfo,
3676
- boundaryName = nextProps.boundaryName,
3677
- heatMapData = nextProps.heatMapData,
3678
- mapVisiblePoints = nextProps.mapVisiblePoints,
3679
- setVisiblePoints = nextProps.setVisiblePoints,
3680
- setCenter = nextProps.setCenter,
3681
- mapCenter = nextProps.mapCenter,
3682
- setZoomLevel = nextProps.setZoomLevel,
3683
- mapZoomLevel = nextProps.mapZoomLevel,
3684
- setCluster = nextProps.setCluster,
3685
- mapCluster = nextProps.mapCluster,
3686
- isRangingTool = nextProps.isRangingTool,
3687
- mapRangingTool = nextProps.mapRangingTool,
3688
- isRemove = nextProps.isRemove,
3689
- mapRemove = nextProps.mapRemove,
3690
- mapDraw = nextProps.mapDraw,
3691
- isDraw = nextProps.isDraw,
3692
- isCloseDraw = nextProps.isCloseDraw,
3693
- editGraphicId = nextProps.editGraphicId,
3694
- isDoEdit = nextProps.isDoEdit,
3695
- isEndEdit = nextProps.isEndEdit,
3696
- mapPointCollection = nextProps.mapPointCollection,
3697
- isclearAllPointCollection = nextProps.isclearAllPointCollection,
3698
- isSetAreaRestriction = nextProps.isSetAreaRestriction,
3699
- areaRestriction = nextProps.areaRestriction,
3700
- isClearAreaRestriction = nextProps.isClearAreaRestriction,
3701
- isClearAll = nextProps.isClearAll;
3702
- var props = t.props;
3703
-
3704
- // 等待地图加载
3705
- if (!t.state.mapCreated) return;
4096
+ mapPoints = _nextProps$mapPoints === void 0 ? [] : _nextProps$mapPoints,
4097
+ _nextProps$mapLines = nextProps.mapLines,
4098
+ mapLines = _nextProps$mapLines === void 0 ? [] : _nextProps$mapLines,
4099
+ _nextProps$mapPolygon = nextProps.mapPolygons,
4100
+ mapPolygons = _nextProps$mapPolygon === void 0 ? [] : _nextProps$mapPolygon,
4101
+ _nextProps$mapCircles = nextProps.mapCircles,
4102
+ mapCircles = _nextProps$mapCircles === void 0 ? [] : _nextProps$mapCircles,
4103
+ _nextProps$customized = nextProps.customizedBoundary,
4104
+ customizedBoundary = _nextProps$customized === void 0 ? [] : _nextProps$customized,
4105
+ isOpenTrafficInfo = nextProps.isOpenTrafficInfo,
4106
+ boundaryName = nextProps.boundaryName,
4107
+ heatMapData = nextProps.heatMapData,
4108
+ mapVisiblePoints = nextProps.mapVisiblePoints,
4109
+ setVisiblePoints = nextProps.setVisiblePoints,
4110
+ setCenter = nextProps.setCenter,
4111
+ mapCenter = nextProps.mapCenter,
4112
+ setZoomLevel = nextProps.setZoomLevel,
4113
+ mapZoomLevel = nextProps.mapZoomLevel,
4114
+ setCluster = nextProps.setCluster,
4115
+ mapCluster = nextProps.mapCluster,
4116
+ isRangingTool = nextProps.isRangingTool,
4117
+ mapRangingTool = nextProps.mapRangingTool,
4118
+ isRemove = nextProps.isRemove,
4119
+ mapRemove = nextProps.mapRemove,
4120
+ mapDraw = nextProps.mapDraw,
4121
+ isDraw = nextProps.isDraw,
4122
+ isCloseDraw = nextProps.isCloseDraw,
4123
+ editGraphicId = nextProps.editGraphicId,
4124
+ isDoEdit = nextProps.isDoEdit,
4125
+ isEndEdit = nextProps.isEndEdit,
4126
+ mapPointCollection = nextProps.mapPointCollection,
4127
+ isclearAllPointCollection = nextProps.isclearAllPointCollection,
4128
+ isSetAreaRestriction = nextProps.isSetAreaRestriction,
4129
+ areaRestriction = nextProps.areaRestriction,
4130
+ isClearAreaRestriction = nextProps.isClearAreaRestriction,
4131
+ isClearAll = nextProps.isClearAll;
4132
+ var props = t.props; // 等待地图加载
3706
4133
 
4134
+ if (!t.state.mapCreated) return;
3707
4135
  /*添加海量点*/
4136
+
3708
4137
  if (mapPointCollection instanceof Array && props.mapPointCollection instanceof Array && !t.deepEqual(mapPointCollection, props.mapPointCollection)) {
3709
4138
  var _t$dataMatch = t.dataMatch(props.mapPointCollection, mapPointCollection, 'id'),
3710
- deletedDataIDs = _t$dataMatch.deletedDataIDs,
3711
- addedData = _t$dataMatch.addedData,
3712
- updatedData = _t$dataMatch.updatedData;
4139
+ deletedDataIDs = _t$dataMatch.deletedDataIDs,
4140
+ addedData = _t$dataMatch.addedData,
4141
+ updatedData = _t$dataMatch.updatedData;
4142
+
3713
4143
  t.clearPointCollection(deletedDataIDs);
3714
4144
  t.addPointCollection(addedData);
3715
4145
  t.updatePointCollection(updatedData);
3716
4146
  }
4147
+
3717
4148
  if (typeof isclearAllPointCollection == 'boolean' && isclearAllPointCollection || isclearAllPointCollection && isclearAllPointCollection !== t.props.isclearAllPointCollection) {
3718
4149
  t.clearAllPointCollection();
3719
4150
  }
@@ -3722,10 +4153,12 @@ var Map = /*#__PURE__*/function (_React$Component) {
3722
4153
  pointData[1]的数据在idsForGraphicId中不存在的,执行新增
3723
4154
  pointData[0]数据中多余的id,执行删除
3724
4155
  */
4156
+
4157
+
3725
4158
  if (mapPoints instanceof Array && props.mapPoints instanceof Array && !t.deepEqual(mapPoints, props.mapPoints)) {
3726
4159
  var oldMapPoints = props.mapPoints;
3727
- var newMapPoints = mapPoints;
3728
- //过滤编辑的图元
4160
+ var newMapPoints = mapPoints; //过滤编辑的图元
4161
+
3729
4162
  if (!!t.state.editId) {
3730
4163
  oldMapPoints = props.mapPoints.filter(function (item) {
3731
4164
  return item.id !== editGraphicId;
@@ -3734,41 +4167,50 @@ var Map = /*#__PURE__*/function (_React$Component) {
3734
4167
  return item.id !== editGraphicId;
3735
4168
  });
3736
4169
  }
4170
+
3737
4171
  var _t$dataMatch2 = t.dataMatch(oldMapPoints, newMapPoints, 'id'),
3738
- _deletedDataIDs = _t$dataMatch2.deletedDataIDs,
3739
- _addedData = _t$dataMatch2.addedData,
3740
- _updatedData = _t$dataMatch2.updatedData;
4172
+ _deletedDataIDs = _t$dataMatch2.deletedDataIDs,
4173
+ _addedData = _t$dataMatch2.addedData,
4174
+ _updatedData = _t$dataMatch2.updatedData;
4175
+
3741
4176
  var _t$dealAdd = t.dealAdd(_addedData, [].concat(_toConsumableArray(pointIds), _toConsumableArray(point))),
3742
- ads = _t$dealAdd.ads,
3743
- otherupds = _t$dealAdd.otherupds;
4177
+ ads = _t$dealAdd.ads,
4178
+ otherupds = _t$dealAdd.otherupds;
4179
+
3744
4180
  var _t$dealUpdate = t.dealUpdate(_updatedData, [].concat(_toConsumableArray(pointIds), _toConsumableArray(point))),
3745
- upds = _t$dealUpdate.upds,
3746
- otherads = _t$dealUpdate.otherads;
3747
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4181
+ upds = _t$dealUpdate.upds,
4182
+ otherads = _t$dealUpdate.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4183
+
4184
+
3748
4185
  var _iterator = _createForOfIteratorHelper(_deletedDataIDs),
3749
- _step;
4186
+ _step;
4187
+
3750
4188
  try {
3751
4189
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3752
4190
  var id = _step.value;
3753
4191
  t.removeGraphic(id, 'point');
3754
- }
3755
- //增加
4192
+ } //增加
4193
+
3756
4194
  } catch (err) {
3757
4195
  _iterator.e(err);
3758
4196
  } finally {
3759
4197
  _iterator.f();
3760
4198
  }
3761
- t.addPoint([].concat(_toConsumableArray(ads), _toConsumableArray(otherads)));
3762
- //更新
4199
+
4200
+ t.addPoint([].concat(_toConsumableArray(ads), _toConsumableArray(otherads))); //更新
4201
+
3763
4202
  t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
3764
4203
  }
3765
4204
  /*
3766
4205
  面数据处理
3767
4206
  先全删除,再新增
3768
4207
  */
4208
+
4209
+
3769
4210
  if (mapPolygons instanceof Array && props.mapPolygons instanceof Array && !t.deepEqual(mapPolygons, props.mapPolygons)) {
3770
4211
  var oldMapPolygons = props.mapPolygons;
3771
4212
  var newMapPolygons = mapPolygons;
4213
+
3772
4214
  if (!!t.state.editId) {
3773
4215
  oldMapPolygons = props.mapPolygons.filter(function (item) {
3774
4216
  return item.id !== editGraphicId;
@@ -3777,41 +4219,50 @@ var Map = /*#__PURE__*/function (_React$Component) {
3777
4219
  return item.id !== editGraphicId;
3778
4220
  });
3779
4221
  }
4222
+
3780
4223
  var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons, 'id'),
3781
- _deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
3782
- _addedData2 = _t$dataMatch3.addedData,
3783
- _updatedData2 = _t$dataMatch3.updatedData;
4224
+ _deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
4225
+ _addedData2 = _t$dataMatch3.addedData,
4226
+ _updatedData2 = _t$dataMatch3.updatedData;
4227
+
3784
4228
  var _t$dealAdd2 = t.dealAdd(_addedData2, [].concat(_toConsumableArray(rectangle), _toConsumableArray(polygon), _toConsumableArray(polygonIds))),
3785
- _ads = _t$dealAdd2.ads,
3786
- _otherupds = _t$dealAdd2.otherupds;
4229
+ _ads = _t$dealAdd2.ads,
4230
+ _otherupds = _t$dealAdd2.otherupds;
4231
+
3787
4232
  var _t$dealUpdate2 = t.dealUpdate(_updatedData2, [].concat(_toConsumableArray(rectangle), _toConsumableArray(polygon), _toConsumableArray(polygonIds))),
3788
- _upds = _t$dealUpdate2.upds,
3789
- _otherads = _t$dealUpdate2.otherads;
3790
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4233
+ _upds = _t$dealUpdate2.upds,
4234
+ _otherads = _t$dealUpdate2.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4235
+
4236
+
3791
4237
  var _iterator2 = _createForOfIteratorHelper(_deletedDataIDs2),
3792
- _step2;
4238
+ _step2;
4239
+
3793
4240
  try {
3794
4241
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3795
4242
  var _id2 = _step2.value;
3796
4243
  t.removeGraphic(_id2, 'polygon');
3797
- }
3798
- //增加
4244
+ } //增加
4245
+
3799
4246
  } catch (err) {
3800
4247
  _iterator2.e(err);
3801
4248
  } finally {
3802
4249
  _iterator2.f();
3803
4250
  }
3804
- t.addPolygon([].concat(_toConsumableArray(_ads), _toConsumableArray(_otherads)));
3805
- //更新
4251
+
4252
+ t.addPolygon([].concat(_toConsumableArray(_ads), _toConsumableArray(_otherads))); //更新
4253
+
3806
4254
  t.updatePolygon([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
3807
4255
  }
3808
4256
  /*
3809
4257
  圆数据处理
3810
4258
  先全删除,再新增
3811
4259
  */
4260
+
4261
+
3812
4262
  if (mapCircles instanceof Array && props.mapCircles instanceof Array && !t.deepEqual(mapCircles, props.mapCircles)) {
3813
4263
  var oldMapCircles = props.mapCircles;
3814
4264
  var newMapCircles = mapCircles;
4265
+
3815
4266
  if (!!t.state.editId) {
3816
4267
  oldMapCircles = props.mapCircles.filter(function (item) {
3817
4268
  return item.id !== editGraphicId;
@@ -3820,41 +4271,50 @@ var Map = /*#__PURE__*/function (_React$Component) {
3820
4271
  return item.id !== editGraphicId;
3821
4272
  });
3822
4273
  }
4274
+
3823
4275
  var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles, 'id'),
3824
- _deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
3825
- _addedData3 = _t$dataMatch4.addedData,
3826
- _updatedData3 = _t$dataMatch4.updatedData;
4276
+ _deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
4277
+ _addedData3 = _t$dataMatch4.addedData,
4278
+ _updatedData3 = _t$dataMatch4.updatedData;
4279
+
3827
4280
  var _t$dealAdd3 = t.dealAdd(_addedData3, [].concat(_toConsumableArray(circleIds), _toConsumableArray(circle))),
3828
- _ads2 = _t$dealAdd3.ads,
3829
- _otherupds2 = _t$dealAdd3.otherupds;
4281
+ _ads2 = _t$dealAdd3.ads,
4282
+ _otherupds2 = _t$dealAdd3.otherupds;
4283
+
3830
4284
  var _t$dealUpdate3 = t.dealUpdate(_updatedData3, [].concat(_toConsumableArray(circleIds), _toConsumableArray(circle))),
3831
- _upds2 = _t$dealUpdate3.upds,
3832
- _otherads2 = _t$dealUpdate3.otherads;
3833
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4285
+ _upds2 = _t$dealUpdate3.upds,
4286
+ _otherads2 = _t$dealUpdate3.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4287
+
4288
+
3834
4289
  var _iterator3 = _createForOfIteratorHelper(_deletedDataIDs3),
3835
- _step3;
4290
+ _step3;
4291
+
3836
4292
  try {
3837
4293
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3838
4294
  var _id3 = _step3.value;
3839
4295
  t.removeGraphic(_id3, 'circle');
3840
- }
3841
- //增加
4296
+ } //增加
4297
+
3842
4298
  } catch (err) {
3843
4299
  _iterator3.e(err);
3844
4300
  } finally {
3845
4301
  _iterator3.f();
3846
4302
  }
3847
- t.addCircle([].concat(_toConsumableArray(_ads2), _toConsumableArray(_otherads2)));
3848
- //更新
4303
+
4304
+ t.addCircle([].concat(_toConsumableArray(_ads2), _toConsumableArray(_otherads2))); //更新
4305
+
3849
4306
  t.updateCircle([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
3850
4307
  }
3851
4308
  /*
3852
4309
  线数据处理
3853
4310
  先全删除,再新增
3854
4311
  */
4312
+
4313
+
3855
4314
  if (mapLines instanceof Array && props.mapLines instanceof Array && !t.deepEqual(mapLines, props.mapLines)) {
3856
4315
  var oldMapLines = props.mapLines;
3857
4316
  var newMapLines = mapLines;
4317
+
3858
4318
  if (!!t.state.editId) {
3859
4319
  oldMapLines = props.mapLines.filter(function (item) {
3860
4320
  return item.id !== editGraphicId;
@@ -3863,43 +4323,52 @@ var Map = /*#__PURE__*/function (_React$Component) {
3863
4323
  return item.id !== editGraphicId;
3864
4324
  });
3865
4325
  }
4326
+
3866
4327
  var _t$dataMatch5 = t.dataMatch(oldMapLines, newMapLines, 'id'),
3867
- _deletedDataIDs4 = _t$dataMatch5.deletedDataIDs,
3868
- _addedData4 = _t$dataMatch5.addedData,
3869
- _updatedData4 = _t$dataMatch5.updatedData;
4328
+ _deletedDataIDs4 = _t$dataMatch5.deletedDataIDs,
4329
+ _addedData4 = _t$dataMatch5.addedData,
4330
+ _updatedData4 = _t$dataMatch5.updatedData;
4331
+
3870
4332
  var _t$dealAdd4 = t.dealAdd(_addedData4, [].concat(_toConsumableArray(lineIds), _toConsumableArray(polyline))),
3871
- _ads3 = _t$dealAdd4.ads,
3872
- _otherupds3 = _t$dealAdd4.otherupds;
4333
+ _ads3 = _t$dealAdd4.ads,
4334
+ _otherupds3 = _t$dealAdd4.otherupds;
4335
+
3873
4336
  var _t$dealUpdate4 = t.dealUpdate(_updatedData4, [].concat(_toConsumableArray(lineIds), _toConsumableArray(polyline))),
3874
- _upds3 = _t$dealUpdate4.upds,
3875
- _otherads3 = _t$dealUpdate4.otherads;
3876
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4337
+ _upds3 = _t$dealUpdate4.upds,
4338
+ _otherads3 = _t$dealUpdate4.otherads; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4339
+
4340
+
3877
4341
  var _iterator4 = _createForOfIteratorHelper(_deletedDataIDs4),
3878
- _step4;
4342
+ _step4;
4343
+
3879
4344
  try {
3880
4345
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
3881
4346
  var _id4 = _step4.value;
3882
4347
  t.removeGraphic(_id4, 'line');
3883
- }
3884
- //增加
4348
+ } //增加
4349
+
3885
4350
  } catch (err) {
3886
4351
  _iterator4.e(err);
3887
4352
  } finally {
3888
4353
  _iterator4.f();
3889
4354
  }
3890
- t.addLine([].concat(_toConsumableArray(_ads3), _toConsumableArray(_otherads3)));
3891
- //更新
4355
+
4356
+ t.addLine([].concat(_toConsumableArray(_ads3), _toConsumableArray(_otherads3))); //更新
4357
+
3892
4358
  t.updateLine([].concat(_toConsumableArray(_upds3), _toConsumableArray(_otherupds3)));
3893
- }
3894
- //画其他特例线专用
4359
+ } //画其他特例线专用
4360
+
4361
+
3895
4362
  if (customizedBoundary instanceof Array && props.customizedBoundary instanceof Array && !t.deepEqual(customizedBoundary, props.customizedBoundary)) {
3896
4363
  var _t$dataMatch6 = t.dataMatch(props.customizedBoundary, customizedBoundary, 'id'),
3897
- _deletedDataIDs5 = _t$dataMatch6.deletedDataIDs,
3898
- _addedData5 = _t$dataMatch6.addedData,
3899
- _updatedData5 = _t$dataMatch6.updatedData;
3900
- //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4364
+ _deletedDataIDs5 = _t$dataMatch6.deletedDataIDs,
4365
+ _addedData5 = _t$dataMatch6.addedData,
4366
+ _updatedData5 = _t$dataMatch6.updatedData; //删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
4367
+
4368
+
3901
4369
  var _iterator5 = _createForOfIteratorHelper(_deletedDataIDs5),
3902
- _step5;
4370
+ _step5;
4371
+
3903
4372
  try {
3904
4373
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
3905
4374
  var _id5 = _step5.value;
@@ -3910,60 +4379,75 @@ var Map = /*#__PURE__*/function (_React$Component) {
3910
4379
  } finally {
3911
4380
  _iterator5.f();
3912
4381
  }
4382
+
3913
4383
  t.addLine(_addedData5);
3914
4384
  t.updateLine(_updatedData5);
3915
- }
3916
- // 获取热力图
4385
+ } // 获取热力图
4386
+
4387
+
3917
4388
  if (heatMapData && !t.deepEqual(heatMapData, props.heatMapData)) {
3918
4389
  t.heatMapOverlay(heatMapData);
3919
- }
3920
- //图元编辑调用
4390
+ } //图元编辑调用
4391
+
4392
+
3921
4393
  if (typeof isDoEdit == 'boolean' && isDoEdit || isDoEdit && isDoEdit !== t.props.isDoEdit) {
3922
4394
  t.doEdit(editGraphicId);
3923
- }
3924
- //关闭图元编辑
4395
+ } //关闭图元编辑
4396
+
4397
+
3925
4398
  if (typeof isEndEdit == 'boolean' && isEndEdit || isEndEdit && isEndEdit !== t.props.isEndEdit) {
3926
4399
  t.endEdit();
3927
- }
3928
- //开启图元绘制
4400
+ } //开启图元绘制
4401
+
4402
+
3929
4403
  if (typeof isDraw == 'boolean' && isDraw || isDraw && isDraw !== t.props.isDraw) {
3930
4404
  t.draw(mapDraw);
3931
- }
3932
- //关闭图元绘制
4405
+ } //关闭图元绘制
4406
+
4407
+
3933
4408
  if (typeof isCloseDraw == 'boolean' && isCloseDraw || isCloseDraw && isCloseDraw !== t.props.isCloseDraw) {
3934
4409
  t.closeDraw();
3935
- }
3936
- //设置中心点
4410
+ } //设置中心点
4411
+
4412
+
3937
4413
  if (typeof setCenter == 'boolean' && setCenter || setCenter && setCenter !== t.props.setCenter) {
3938
4414
  t.setCenter(mapCenter);
3939
- }
3940
- //设置点聚合
4415
+ } //设置点聚合
4416
+
4417
+
3941
4418
  if (typeof setCluster == 'boolean' && setCluster || setCluster && setCluster !== t.props.setCluster) {
3942
4419
  t.cluster(mapCluster);
3943
- }
3944
- //设置比例尺
4420
+ } //设置比例尺
4421
+
4422
+
3945
4423
  if (typeof setZoomLevel == 'boolean' && setZoomLevel || setZoomLevel && setZoomLevel !== t.props.setZoomLevel) {
3946
4424
  t.setZoomLevel(mapZoomLevel);
3947
4425
  }
3948
4426
  /*设置指定图元展示*/
4427
+
4428
+
3949
4429
  if (typeof setVisiblePoints == 'boolean' && setVisiblePoints || setVisiblePoints && setVisiblePoints !== t.props.setVisiblePoints) {
3950
4430
  t.setVisiblePoints(mapVisiblePoints);
3951
- }
3952
- //测距工具调用
4431
+ } //测距工具调用
4432
+
4433
+
3953
4434
  if (typeof isRangingTool == 'boolean' && isRangingTool || isRangingTool && isRangingTool !== t.props.isRangingTool) {
3954
4435
  t.vtxRangingTool(mapRangingTool);
3955
- }
3956
- //开关路况
4436
+ } //开关路况
4437
+
4438
+
3957
4439
  if (isOpenTrafficInfo) {
3958
4440
  t.openTrafficInfo();
3959
4441
  } else {
3960
4442
  t.hideTrafficInfo();
3961
- }
3962
- //清空地图
4443
+ } //清空地图
4444
+
4445
+
3963
4446
  if (typeof isClearAll == 'boolean' && isClearAll || isClearAll && isClearAll !== t.props.isClearAll) {
3964
4447
  t.clearAll();
3965
- }
3966
- //删除指定图元
4448
+ } //删除指定图元
4449
+
4450
+
3967
4451
  if (typeof isRemove == 'boolean' && isRemove || isRemove && isRemove !== t.props.isRemove) {
3968
4452
  mapRemove.map(function (item, index) {
3969
4453
  t.removeGraphic(item.id, item.type);
@@ -3975,27 +4459,37 @@ var Map = /*#__PURE__*/function (_React$Component) {
3975
4459
  value: function componentWillUnmount() {
3976
4460
  //关闭moveTo定时
3977
4461
  var t = this;
4462
+
3978
4463
  if (t.loadLabel) {
3979
4464
  clearInterval(t.loadLabel);
3980
4465
  }
4466
+
3981
4467
  if (t.upPsTimer) {
3982
4468
  clearTimeout(t.upPsTimer);
3983
4469
  }
4470
+
3984
4471
  if (t.addPsTimer) {
3985
4472
  clearTimeout(t.addPsTimer);
3986
4473
  }
4474
+
3987
4475
  if (t.state.gis) {
3988
4476
  t.state.gis.clearOverlays();
3989
4477
  }
4478
+
3990
4479
  t.state.gis = null;
4480
+
3991
4481
  if (t.moveToTimer) {
3992
4482
  clearInterval(t.moveToTimer);
3993
4483
  }
4484
+
3994
4485
  window.VtxMap[t.state.mapId] = null;
3995
4486
  }
3996
4487
  }]);
4488
+
3997
4489
  return Map;
3998
4490
  }(_react["default"].Component);
3999
- var _default = exports["default"] = Map;
4491
+
4492
+ var _default = Map;
4493
+ exports["default"] = _default;
4000
4494
  module.exports = exports["default"];
4001
4495
  //# sourceMappingURL=Map.js.map