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