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