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