@vtx/map 1.1.35 → 1.1.37

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