@vtx/map 1.1.47 → 1.1.49

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