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