@vtx/map 1.2.22 → 1.2.24

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