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