@vtx/map 1.2.30 → 6.0.0-beta.1
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/README.md +44 -44
- package/lib/VtxMap/AMap/AMap.js +359 -355
- package/lib/VtxMap/BMap/Map.js +331 -330
- package/lib/VtxMap/BMap/Map1.js +1712 -0
- package/lib/VtxMap/GMap/Map.js +432 -427
- package/lib/VtxMap/Map.js +31 -27
- package/lib/VtxMap/MapToolFunction.js +6 -7
- package/lib/VtxMap/OMap/Map.js +410 -405
- package/lib/VtxMap/OMap/Map.less +70 -70
- package/lib/VtxMap/OlMap/Map.js +450 -440
- package/lib/VtxMap/OlMap/Map.less +230 -230
- package/lib/VtxMap/TMap/TMap.js +321 -318
- package/lib/VtxMap/index.js +10 -11
- package/lib/VtxMap/mapPlayer.js +15 -16
- package/lib/VtxMap/optimizingPointMap.js +35 -33
- package/lib/VtxMap/style/index.js +1 -2
- package/lib/VtxMap/zoomMap.js +24 -23
- package/lib/VtxModal/VtxModal.js +94 -82
- package/lib/VtxModal/VtxModal.less +83 -52
- package/lib/VtxModal/draggableModal.js +35 -33
- package/lib/VtxModal/index.js +6 -7
- package/lib/VtxModal/style/index.js +1 -15
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js +265 -244
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.less +69 -43
- package/lib/VtxSearchCheckMap/index.js +4 -9
- package/lib/VtxSearchCheckMap/mapping.js +1 -2
- package/lib/VtxSearchCheckMap/style/index.js +5 -11
- package/lib/VtxSearchMap/VtxSearchMap.js +326 -288
- package/lib/VtxSearchMap/VtxSearchMap.less +74 -47
- package/lib/VtxSearchMap/VtxSearchMapAntd3.less +1 -1
- package/lib/VtxSearchMap/index.js +4 -9
- package/lib/VtxSearchMap/mapping.js +1 -2
- package/lib/VtxSearchMap/style/index.js +1 -28
- package/lib/default.js +44 -24
- package/lib/index.js +30 -31
- package/lib/utils/util.js +3 -4
- package/package.json +19 -27
- package/lib/VtxMap/AMap/AMap.css +0 -27
- package/lib/VtxMap/AMap/AMap.js.map +0 -1
- package/lib/VtxMap/BMap/Map.css +0 -26
- package/lib/VtxMap/BMap/Map.js.map +0 -1
- package/lib/VtxMap/GMap/Map.css +0 -88
- package/lib/VtxMap/GMap/Map.js.map +0 -1
- package/lib/VtxMap/Map.css +0 -7
- package/lib/VtxMap/Map.js.map +0 -1
- package/lib/VtxMap/MapToolFunction.js.map +0 -1
- package/lib/VtxMap/OMap/Map.css +0 -76
- package/lib/VtxMap/OMap/Map.js.map +0 -1
- package/lib/VtxMap/OlMap/Map.css +0 -229
- package/lib/VtxMap/OlMap/Map.js.map +0 -1
- package/lib/VtxMap/TMap/TMap.css +0 -31
- package/lib/VtxMap/TMap/TMap.js.map +0 -1
- package/lib/VtxMap/index.js.map +0 -1
- package/lib/VtxMap/mapPlayer.js.map +0 -1
- package/lib/VtxMap/optimizingPointMap.js.map +0 -1
- package/lib/VtxMap/style/css.js +0 -10
- package/lib/VtxMap/style/css.js.map +0 -1
- package/lib/VtxMap/style/index.js.map +0 -1
- package/lib/VtxMap/zoomMap.js.map +0 -1
- package/lib/VtxModal/VtxModal.css +0 -62
- package/lib/VtxModal/VtxModal.js.map +0 -1
- package/lib/VtxModal/VtxModalAntd3.css +0 -62
- package/lib/VtxModal/VtxModalAntd3.less +0 -67
- package/lib/VtxModal/draggableModal.js.map +0 -1
- package/lib/VtxModal/index.js.map +0 -1
- package/lib/VtxModal/style/css.js +0 -15
- package/lib/VtxModal/style/css.js.map +0 -1
- package/lib/VtxModal/style/index.js.map +0 -1
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.css +0 -182
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js.map +0 -1
- package/lib/VtxSearchCheckMap/VtxSearchCheckMapAntd3.css +0 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMapAntd3.less +0 -1
- package/lib/VtxSearchCheckMap/index.js.map +0 -1
- package/lib/VtxSearchCheckMap/mapping.js.map +0 -1
- package/lib/VtxSearchCheckMap/style/css.js +0 -28
- package/lib/VtxSearchCheckMap/style/css.js.map +0 -1
- package/lib/VtxSearchCheckMap/style/index.js.map +0 -1
- package/lib/VtxSearchMap/VtxSearchMap.css +0 -202
- package/lib/VtxSearchMap/VtxSearchMap.js.map +0 -1
- package/lib/VtxSearchMap/VtxSearchMapAntd3.css +0 -0
- package/lib/VtxSearchMap/index.js.map +0 -1
- package/lib/VtxSearchMap/mapping.js.map +0 -1
- package/lib/VtxSearchMap/style/css.js +0 -28
- package/lib/VtxSearchMap/style/css.js.map +0 -1
- package/lib/VtxSearchMap/style/index.js.map +0 -1
- package/lib/default.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/utils/util.js.map +0 -1
package/lib/VtxMap/AMap/AMap.js
CHANGED
|
@@ -4,45 +4,50 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactDom = require("react-dom");
|
|
10
10
|
var _MapToolFunction = require("../MapToolFunction");
|
|
11
11
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
12
|
-
var _default2 =
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
function
|
|
12
|
+
var _default2 = _interopRequireWildcard(require("../../default"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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; } } }; }
|
|
18
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
19
|
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."); }
|
|
17
|
-
function _unsupportedIterableToArray(
|
|
18
|
-
function _iterableToArray(
|
|
19
|
-
function _arrayWithoutHoles(
|
|
20
|
-
function _arrayLikeToArray(
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
24
|
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
25
|
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(
|
|
24
|
-
function _classCallCheck(
|
|
25
|
-
function _defineProperties(
|
|
26
|
-
function _createClass(
|
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i
|
|
26
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
29
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
31
|
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
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
function
|
|
34
|
-
function
|
|
35
|
-
function
|
|
36
|
-
var Set = _immutable
|
|
32
|
+
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); }
|
|
33
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
34
|
+
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); }; }
|
|
35
|
+
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); }
|
|
36
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
+
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; } }
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } //公共地址配置
|
|
39
|
+
var Set = _immutable.default.Set;
|
|
37
40
|
var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
_inherits(VortexAMap, _React$Component);
|
|
42
|
+
var _super = _createSuper(VortexAMap);
|
|
38
43
|
function VortexAMap(props) {
|
|
39
44
|
var _this;
|
|
40
45
|
_classCallCheck(this, VortexAMap);
|
|
41
|
-
_this =
|
|
46
|
+
_this = _super.call(this, props);
|
|
42
47
|
//初始化 图元管理方法
|
|
43
48
|
_this.GM = new _MapToolFunction.graphicManage();
|
|
44
49
|
_this.getPolygonArea = _MapToolFunction.getPolygonArea;
|
|
45
|
-
_this.pointCollectionId =
|
|
50
|
+
_this.pointCollectionId = "vtx_gmap_html_pointCollection"; //海量点canvas点位容器id class管理
|
|
46
51
|
_this.morepoints = []; //海量点集合
|
|
47
52
|
_this.htmlXY = {
|
|
48
53
|
x: 0,
|
|
@@ -82,9 +87,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
82
87
|
//地图上面的ids
|
|
83
88
|
circleIds: [],
|
|
84
89
|
//地图上圆的ids
|
|
85
|
-
editId:
|
|
90
|
+
editId: "",
|
|
86
91
|
//当前编辑的图元id
|
|
87
|
-
editGraphic:
|
|
92
|
+
editGraphic: "",
|
|
88
93
|
//当前编辑完后图元所有数据
|
|
89
94
|
// center: props.mapCenter,
|
|
90
95
|
mapZoomLevel: props.mapZoomLevel,
|
|
@@ -100,60 +105,61 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
100
105
|
}
|
|
101
106
|
};
|
|
102
107
|
_this.AnchorConstant = {
|
|
103
|
-
tr:
|
|
104
|
-
tl:
|
|
105
|
-
bl:
|
|
106
|
-
br:
|
|
108
|
+
tr: "RT",
|
|
109
|
+
tl: "LT",
|
|
110
|
+
bl: "LB",
|
|
111
|
+
br: "RB"
|
|
107
112
|
};
|
|
108
|
-
_this.language = props.language ||
|
|
113
|
+
_this.language = props.language || "zh_cn";
|
|
109
114
|
_this.frameSelectProps = {};
|
|
110
115
|
_this.loadMapJs();
|
|
111
116
|
return _this;
|
|
112
117
|
}
|
|
113
|
-
|
|
114
|
-
return _createClass(VortexAMap, [{
|
|
118
|
+
_createClass(VortexAMap, [{
|
|
115
119
|
key: "loadMapJs",
|
|
116
120
|
value: function loadMapJs() {
|
|
117
121
|
this.loadMapComplete = new Promise(function (resolve, reject) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$.getScript(_default2
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
(0, _default2.ensurejQuery)().then(function () {
|
|
123
|
+
if (window.AMap) {
|
|
124
|
+
resolve(window.AMap);
|
|
125
|
+
} else {
|
|
126
|
+
$.getScript("".concat(_default2.default.mapServerURL, "/A_content.js"), function () {
|
|
127
|
+
$.getScript(_default2.default.amapScriptUrl, function () {
|
|
128
|
+
var PointCollection = new Promise(function (resolve, reject) {
|
|
129
|
+
$.getScript("".concat(_default2.default.mapServerURL, "/GPointCollection.js"), function () {
|
|
130
|
+
resolve();
|
|
131
|
+
});
|
|
126
132
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
Promise.all([PointCollection]).then(function () {
|
|
134
|
+
(function setTime() {
|
|
135
|
+
var allEvents = [window.AMap, "MarkerClusterer", "MapType", "Scale", "ToolBar", "DistrictSearch", "RangingTool", "MouseTool", "PolyEditor", "CircleEditor", "PlaceSearch", "Heatmap"];
|
|
136
|
+
var isLoading = true;
|
|
137
|
+
for (var i = 0; i <= allEvents.length - 1; i++) {
|
|
138
|
+
if (i === 0) {
|
|
139
|
+
if (!allEvents[i]) {
|
|
140
|
+
isLoading = false;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
if (!allEvents[0][allEvents[i]]) {
|
|
145
|
+
isLoading = false;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
137
148
|
}
|
|
149
|
+
}
|
|
150
|
+
if (isLoading) {
|
|
151
|
+
resolve(window.AMap);
|
|
138
152
|
} else {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
153
|
+
setTimeout(function () {
|
|
154
|
+
setTime();
|
|
155
|
+
}, 50);
|
|
143
156
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
resolve(window.AMap);
|
|
147
|
-
} else {
|
|
148
|
-
setTimeout(function () {
|
|
149
|
-
setTime();
|
|
150
|
-
}, 50);
|
|
151
|
-
}
|
|
152
|
-
})();
|
|
157
|
+
})();
|
|
158
|
+
});
|
|
153
159
|
});
|
|
154
160
|
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
157
163
|
});
|
|
158
164
|
}
|
|
159
165
|
//初始化地图
|
|
@@ -293,7 +299,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
293
299
|
window.VtxMap = {};
|
|
294
300
|
}
|
|
295
301
|
window.VtxMap[mapId] = t.state.gis = new AMap.Map(mapId.toString(), {
|
|
296
|
-
viewMode: viewMode ? viewMode :
|
|
302
|
+
viewMode: viewMode ? viewMode : "2D",
|
|
297
303
|
resizeEnable: true,
|
|
298
304
|
//zoom等级,和百度一样默认10
|
|
299
305
|
zoom: mapZoomLevel || 10,
|
|
@@ -311,31 +317,31 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
311
317
|
/*算出比例尺位置偏移量*/
|
|
312
318
|
var offsetS = new AMap.Pixel(60, 17);
|
|
313
319
|
var offsetT = new AMap.Pixel(25, 10);
|
|
314
|
-
var zlt =
|
|
315
|
-
var zls =
|
|
320
|
+
var zlt = "RB";
|
|
321
|
+
var zls = "RB";
|
|
316
322
|
if (t.props.showControl) {
|
|
317
323
|
switch (t.props.showControl.location) {
|
|
318
|
-
case
|
|
319
|
-
zlt =
|
|
320
|
-
zls =
|
|
324
|
+
case "tl":
|
|
325
|
+
zlt = "LT";
|
|
326
|
+
zls = "LB";
|
|
321
327
|
offsetS = new AMap.Pixel(10, 17);
|
|
322
328
|
offsetT = new AMap.Pixel(5, 10);
|
|
323
329
|
break;
|
|
324
|
-
case
|
|
325
|
-
zlt =
|
|
326
|
-
zls =
|
|
330
|
+
case "bl":
|
|
331
|
+
zlt = "LB";
|
|
332
|
+
zls = "LB";
|
|
327
333
|
offsetS = new AMap.Pixel(60, 19);
|
|
328
334
|
offsetT = new AMap.Pixel(5, 12);
|
|
329
335
|
break;
|
|
330
|
-
case
|
|
331
|
-
zlt =
|
|
332
|
-
zls =
|
|
336
|
+
case "tr":
|
|
337
|
+
zlt = "RT";
|
|
338
|
+
zls = "RB";
|
|
333
339
|
offsetS = new AMap.Pixel(25, 17);
|
|
334
340
|
offsetT = new AMap.Pixel(25, 10);
|
|
335
341
|
break;
|
|
336
|
-
case
|
|
337
|
-
zlt =
|
|
338
|
-
zls =
|
|
342
|
+
case "br":
|
|
343
|
+
zlt = "RB";
|
|
344
|
+
zls = "RB";
|
|
339
345
|
offsetS = new AMap.Pixel(70, 17);
|
|
340
346
|
offsetT = new AMap.Pixel(25, 10);
|
|
341
347
|
break;
|
|
@@ -346,19 +352,19 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
346
352
|
direction: true
|
|
347
353
|
};
|
|
348
354
|
switch (t.props.showControl.type) {
|
|
349
|
-
case
|
|
355
|
+
case "small":
|
|
350
356
|
tp = {
|
|
351
357
|
ruler: false,
|
|
352
358
|
direction: true
|
|
353
359
|
};
|
|
354
360
|
break;
|
|
355
|
-
case
|
|
361
|
+
case "pan":
|
|
356
362
|
tp = {
|
|
357
363
|
ruler: false,
|
|
358
364
|
direction: true
|
|
359
365
|
};
|
|
360
366
|
break;
|
|
361
|
-
case
|
|
367
|
+
case "zoom":
|
|
362
368
|
tp = {
|
|
363
369
|
ruler: false,
|
|
364
370
|
direction: false
|
|
@@ -380,15 +386,15 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
380
386
|
var opts = {
|
|
381
387
|
subdistrict: 1,
|
|
382
388
|
//返回下一级行政区
|
|
383
|
-
extensions:
|
|
389
|
+
extensions: "all",
|
|
384
390
|
//返回行政区边界坐标组等具体信息
|
|
385
|
-
level:
|
|
391
|
+
level: "district" //查询行政级别为 市
|
|
386
392
|
};
|
|
387
393
|
//实例化DistrictSearch
|
|
388
394
|
t.districeSearch = new AMap.DistrictSearch(opts);
|
|
389
395
|
//实例化RangingTool
|
|
390
396
|
t.ruler = new AMap.RangingTool(t.state.gis);
|
|
391
|
-
t.ruler.on(
|
|
397
|
+
t.ruler.on("end", function (_ref) {
|
|
392
398
|
var type = _ref.type,
|
|
393
399
|
polyline = _ref.polyline,
|
|
394
400
|
points = _ref.points,
|
|
@@ -409,7 +415,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
409
415
|
//绘制图元类
|
|
410
416
|
t.mousetool = new AMap.MouseTool(t.state.gis);
|
|
411
417
|
//绘制完后的回调
|
|
412
|
-
t.mousetool.on(
|
|
418
|
+
t.mousetool.on("draw", function (_ref2) {
|
|
413
419
|
var _t$frameSelectProps$b;
|
|
414
420
|
var type = _ref2.type,
|
|
415
421
|
obj = _ref2.obj;
|
|
@@ -417,23 +423,23 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
417
423
|
var backobj = {
|
|
418
424
|
id: drawExtData.id,
|
|
419
425
|
attributes: drawExtData.attributes,
|
|
420
|
-
geometryType: drawExtData.type ==
|
|
426
|
+
geometryType: drawExtData.type == "rectangle" ? "polygon" : drawExtData.type,
|
|
421
427
|
mapLayer: obj,
|
|
422
428
|
geometry: {
|
|
423
|
-
type: drawExtData.type ==
|
|
429
|
+
type: drawExtData.type == "rectangle" ? "polygon" : drawExtData.type
|
|
424
430
|
}
|
|
425
431
|
};
|
|
426
432
|
//缓存绘制的图元信息
|
|
427
433
|
t.GM.setGraphic(drawExtData.id, obj);
|
|
428
434
|
t.GM.setGraphicParam(drawExtData.id, backobj);
|
|
429
435
|
//添加点击事件
|
|
430
|
-
obj.on(
|
|
436
|
+
obj.on("click", function (e) {
|
|
431
437
|
t.clickGraphic(drawExtData.id, e);
|
|
432
438
|
});
|
|
433
|
-
obj.on(
|
|
439
|
+
obj.on("mouseover", function (e) {
|
|
434
440
|
t.mouseOverGraphic(drawExtData.id, e);
|
|
435
441
|
});
|
|
436
|
-
obj.on(
|
|
442
|
+
obj.on("mouseout", function (e) {
|
|
437
443
|
t.mouseOutGraphic(drawExtData.id, e);
|
|
438
444
|
});
|
|
439
445
|
|
|
@@ -444,29 +450,29 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
444
450
|
path = _t$dealData.path;
|
|
445
451
|
//处理返回数据
|
|
446
452
|
switch (drawExtData.type) {
|
|
447
|
-
case
|
|
453
|
+
case "point":
|
|
448
454
|
backobj.geometry.x = obj.getPosition().getLng();
|
|
449
455
|
backobj.geometry.y = obj.getPosition().getLat();
|
|
450
456
|
break;
|
|
451
|
-
case
|
|
457
|
+
case "polyline":
|
|
452
458
|
backobj.lnglatAry = lnglatAry;
|
|
453
459
|
backobj.geometry.paths = path;
|
|
454
460
|
backobj.geometry._extent = _extent;
|
|
455
461
|
backobj.distance = obj.getLength();
|
|
456
462
|
break;
|
|
457
|
-
case
|
|
463
|
+
case "polygon":
|
|
458
464
|
backobj.area = obj.getArea();
|
|
459
465
|
backobj.lnglatAry = lnglatAry;
|
|
460
466
|
backobj.geometry.rings = path;
|
|
461
467
|
backobj.geometry._extent = _extent;
|
|
462
468
|
break;
|
|
463
|
-
case
|
|
469
|
+
case "rectangle":
|
|
464
470
|
backobj.area = obj.getArea();
|
|
465
471
|
backobj.lnglatAry = lnglatAry;
|
|
466
472
|
backobj.geometry.rings = path;
|
|
467
473
|
backobj.geometry._extent = _extent;
|
|
468
474
|
break;
|
|
469
|
-
case
|
|
475
|
+
case "circle":
|
|
470
476
|
backobj.geometry.x = obj.getCenter().getLng();
|
|
471
477
|
backobj.geometry.y = obj.getCenter().getLat();
|
|
472
478
|
backobj.geometry.radius = obj.getRadius();
|
|
@@ -476,7 +482,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
476
482
|
//恢复鼠标默认样式
|
|
477
483
|
t.state.gis.setDefaultCursor();
|
|
478
484
|
t.mousetool.close();
|
|
479
|
-
if (
|
|
485
|
+
if ("drawEnd" in t.props) {
|
|
480
486
|
t.props.drawEnd(backobj);
|
|
481
487
|
}
|
|
482
488
|
if (((_t$frameSelectProps$b = t.frameSelectProps[backobj.id]) === null || _t$frameSelectProps$b === void 0 ? void 0 : _t$frameSelectProps$b.callback) instanceof Function) {
|
|
@@ -484,13 +490,13 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
484
490
|
}
|
|
485
491
|
});
|
|
486
492
|
t.heatmap = new AMap.Heatmap(t.state.gis);
|
|
487
|
-
t.state.gis.on(
|
|
493
|
+
t.state.gis.on("mapmove", function (e) {
|
|
488
494
|
if (t.htmlXY.isCount) {
|
|
489
495
|
var nowXY = t.state.gis.lnglatToPixel(t.state.gis.getCenter());
|
|
490
496
|
$("#".concat(t.pointCollectionId)).css({
|
|
491
497
|
top: t.htmlXY.y - nowXY.y,
|
|
492
498
|
left: t.htmlXY.x - nowXY.x,
|
|
493
|
-
display:
|
|
499
|
+
display: "none"
|
|
494
500
|
});
|
|
495
501
|
}
|
|
496
502
|
});
|
|
@@ -528,20 +534,20 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
528
534
|
parameter = _ref3$parameter === void 0 ? {} : _ref3$parameter,
|
|
529
535
|
_ref3$data = _ref3.data,
|
|
530
536
|
data = _ref3$data === void 0 ? {} : _ref3$data;
|
|
531
|
-
if (![
|
|
537
|
+
if (!["polygon", "circle", "rectangle"].includes(geometryType)) {
|
|
532
538
|
message.warn("传入的类型不支持框选!");
|
|
533
539
|
return false;
|
|
534
540
|
}
|
|
535
541
|
var t = this;
|
|
536
542
|
var params = {},
|
|
537
|
-
type = geometryType ||
|
|
543
|
+
type = geometryType || "polygon",
|
|
538
544
|
id = data.id || "frameSelectFeature_".concat(Math.random());
|
|
539
|
-
params.color = parameter.color ||
|
|
540
|
-
params.lineColor = parameter.lineColor ||
|
|
545
|
+
params.color = parameter.color || "red";
|
|
546
|
+
params.lineColor = parameter.lineColor || "red";
|
|
541
547
|
params.lineOpacity = parameter.lineOpacity || 1;
|
|
542
548
|
params.lineWidth = parameter.lineWidth || 2;
|
|
543
549
|
params.pellucidity = parameter.pellucidity || 0.6;
|
|
544
|
-
params.lineType = parameter.lineType ||
|
|
550
|
+
params.lineType = parameter.lineType || "solid";
|
|
545
551
|
t.draw({
|
|
546
552
|
geometryType: type,
|
|
547
553
|
parameter: _objectSpread(_objectSpread({}, parameter), params),
|
|
@@ -573,12 +579,12 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
573
579
|
delete this.frameSelectProps[id];
|
|
574
580
|
}
|
|
575
581
|
/*
|
|
576
|
-
|
|
577
|
-
|
|
582
|
+
切换地图矢量图和卫星图背景
|
|
583
|
+
*/
|
|
578
584
|
}, {
|
|
579
585
|
key: "setMapType",
|
|
580
586
|
value: function setMapType(type) {
|
|
581
|
-
if (!this.satellite && type ==
|
|
587
|
+
if (!this.satellite && type == "wx") {
|
|
582
588
|
this.satellite = new AMap.TileLayer.Satellite({
|
|
583
589
|
map: this.state.gis
|
|
584
590
|
});
|
|
@@ -588,11 +594,11 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
588
594
|
}
|
|
589
595
|
if (this.satellite) {
|
|
590
596
|
switch (type) {
|
|
591
|
-
case
|
|
597
|
+
case "sl":
|
|
592
598
|
this.satellite.hide();
|
|
593
599
|
this.roadNet.hide();
|
|
594
600
|
break;
|
|
595
|
-
case
|
|
601
|
+
case "wx":
|
|
596
602
|
this.satellite.show();
|
|
597
603
|
this.roadNet.show();
|
|
598
604
|
break;
|
|
@@ -623,12 +629,12 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
623
629
|
}
|
|
624
630
|
if (sw && ne && Array.isArray(sw) && Array.isArray(ne) && sw[0] && sw[1] && ne[0] && ne[1]) {
|
|
625
631
|
var swnep = new AMap.Bounds(sw, ne),
|
|
626
|
-
|
|
632
|
+
imageUrlOverlay = new AMap.ImageLayer({
|
|
627
633
|
url: url,
|
|
628
634
|
zooms: [displayOnMinLevel || 3, displayOnMaxLevel || 18],
|
|
629
635
|
bounds: swnep
|
|
630
636
|
});
|
|
631
|
-
t.state.gis.setLayers([new AMap.TileLayer(),
|
|
637
|
+
t.state.gis.setLayers([new AMap.TileLayer(), imageUrlOverlay]);
|
|
632
638
|
} else {
|
|
633
639
|
console.warn("\u533A\u57DF\u7ECF\u7EAC\u5EA6sw/ne\u6570\u636E\u9519\u8BEF");
|
|
634
640
|
return false;
|
|
@@ -722,32 +728,32 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
722
728
|
var t = this;
|
|
723
729
|
var ids = [];
|
|
724
730
|
switch (obj.fitView) {
|
|
725
|
-
case
|
|
726
|
-
t.state.gis.setFitView(t.state.gis.getAllOverlays(
|
|
731
|
+
case "point":
|
|
732
|
+
t.state.gis.setFitView(t.state.gis.getAllOverlays("marker"));
|
|
727
733
|
break;
|
|
728
|
-
case
|
|
729
|
-
t.state.gis.setFitView(t.state.gis.getAllOverlays(
|
|
734
|
+
case "line":
|
|
735
|
+
t.state.gis.setFitView(t.state.gis.getAllOverlays("polyline"));
|
|
730
736
|
break;
|
|
731
|
-
case
|
|
732
|
-
t.state.gis.setFitView(t.state.gis.getAllOverlays(
|
|
737
|
+
case "polygon":
|
|
738
|
+
t.state.gis.setFitView(t.state.gis.getAllOverlays("polygon"));
|
|
733
739
|
break;
|
|
734
|
-
case
|
|
735
|
-
t.state.gis.setFitView(t.state.gis.getAllOverlays(
|
|
740
|
+
case "circle":
|
|
741
|
+
t.state.gis.setFitView(t.state.gis.getAllOverlays("circle"));
|
|
736
742
|
break;
|
|
737
|
-
case
|
|
738
|
-
var pts = [].concat(_toConsumableArray(t.state.gis.getAllOverlays(
|
|
743
|
+
case "all":
|
|
744
|
+
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")));
|
|
739
745
|
t.state.gis.setFitView(pts);
|
|
740
746
|
break;
|
|
741
747
|
default:
|
|
742
748
|
if (obj.fitView instanceof Array) {
|
|
743
749
|
ids = obj.fitView;
|
|
744
|
-
} else if (typeof obj.fitView ===
|
|
745
|
-
ids = obj.fitView.split(
|
|
750
|
+
} else if (typeof obj.fitView === "string") {
|
|
751
|
+
ids = obj.fitView.split(",");
|
|
746
752
|
}
|
|
747
753
|
if (ids[0] instanceof Array) {
|
|
748
754
|
// let l = new AMap.LngLat(ids[0][0],ids[0][1]),
|
|
749
|
-
// r = new AMap.LngLat(ids[1][0],ids[1][1]);
|
|
750
|
-
// let b = new AMap.Bounds(l,r);
|
|
755
|
+
// r = new AMap.LngLat(ids[1][0],ids[1][1]);
|
|
756
|
+
// let b = new AMap.Bounds(l,r);
|
|
751
757
|
// t.state.gis.setBounds(b);
|
|
752
758
|
// fix: 高德地图在[[lng,lat],[lng,lat]]方式下的最佳视野
|
|
753
759
|
t.state.gis.setFitView(ids.map(function (item) {
|
|
@@ -807,8 +813,8 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
807
813
|
value: function getMapExtent() {
|
|
808
814
|
var t = this;
|
|
809
815
|
var gis = t.state.gis;
|
|
810
|
-
var northEast = (this.props.viewMode ==
|
|
811
|
-
southWest = (this.props.viewMode ==
|
|
816
|
+
var northEast = (this.props.viewMode == "3D" ? gis.getBounds().toBounds() : gis.getBounds()).getNorthEast(),
|
|
817
|
+
southWest = (this.props.viewMode == "3D" ? gis.getBounds().toBounds() : gis.getBounds()).getSouthWest();
|
|
812
818
|
var obj = {
|
|
813
819
|
mapSize: gis.getSize(),
|
|
814
820
|
nowCenter: t.getCurrentCenter(),
|
|
@@ -835,10 +841,10 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
835
841
|
var pointIds = t.state.pointIds;
|
|
836
842
|
ary = pointIds;
|
|
837
843
|
} else {
|
|
838
|
-
if (Object.prototype.toString.apply(arg) ===
|
|
844
|
+
if (Object.prototype.toString.apply(arg) === "[object Array]") {
|
|
839
845
|
ary = arg;
|
|
840
|
-
} else if (typeof arg ===
|
|
841
|
-
ary = arg.split(
|
|
846
|
+
} else if (typeof arg === "string") {
|
|
847
|
+
ary = arg.split(",");
|
|
842
848
|
}
|
|
843
849
|
}
|
|
844
850
|
ary = ary.filter(function (item, index) {
|
|
@@ -867,7 +873,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
867
873
|
key: "showControl",
|
|
868
874
|
value: function showControl(props) {
|
|
869
875
|
var t = this,
|
|
870
|
-
location =
|
|
876
|
+
location = "RT",
|
|
871
877
|
offset = null,
|
|
872
878
|
scaleOffset = null;
|
|
873
879
|
var config = props || t.props;
|
|
@@ -918,7 +924,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
918
924
|
key: "showMapTypeControl",
|
|
919
925
|
value: function showMapTypeControl(props) {
|
|
920
926
|
var t = this,
|
|
921
|
-
location =
|
|
927
|
+
location = "RT",
|
|
922
928
|
offset = null;
|
|
923
929
|
var config = props || t.props;
|
|
924
930
|
if (t.mapTypeControl) {
|
|
@@ -938,73 +944,72 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
938
944
|
|
|
939
945
|
// TODO,MapType没有这些属性,所以下面定位和偏移不生效,手动修改
|
|
940
946
|
function reloaction() {
|
|
941
|
-
if (location ==
|
|
942
|
-
$(
|
|
947
|
+
if (location == "RT") {
|
|
948
|
+
$("div.amap-maptypecontrol").css({
|
|
943
949
|
right: 0,
|
|
944
950
|
top: 0,
|
|
945
|
-
left:
|
|
946
|
-
bottom:
|
|
951
|
+
left: "inherit",
|
|
952
|
+
bottom: "inherit"
|
|
947
953
|
});
|
|
948
|
-
} else if (location ==
|
|
949
|
-
$(
|
|
954
|
+
} else if (location == "LT") {
|
|
955
|
+
$("div.amap-maptypecontrol").css({
|
|
950
956
|
left: 0 + 64,
|
|
951
957
|
top: 0,
|
|
952
|
-
right:
|
|
953
|
-
bottom:
|
|
958
|
+
right: "inherit",
|
|
959
|
+
bottom: "inherit"
|
|
954
960
|
});
|
|
955
|
-
} else if (location ==
|
|
956
|
-
$(
|
|
961
|
+
} else if (location == "LB") {
|
|
962
|
+
$("div.amap-maptypecontrol").css({
|
|
957
963
|
left: 0 + 64,
|
|
958
964
|
bottom: 0 + 84,
|
|
959
|
-
right:
|
|
960
|
-
top:
|
|
965
|
+
right: "inherit",
|
|
966
|
+
top: "inherit"
|
|
961
967
|
});
|
|
962
|
-
} else if (location ==
|
|
963
|
-
$(
|
|
968
|
+
} else if (location == "RB") {
|
|
969
|
+
$("div.amap-maptypecontrol").css({
|
|
964
970
|
right: 0,
|
|
965
971
|
bottom: 0 + 84,
|
|
966
|
-
left:
|
|
967
|
-
top:
|
|
972
|
+
left: "inherit",
|
|
973
|
+
top: "inherit"
|
|
968
974
|
});
|
|
969
975
|
}
|
|
970
976
|
if (config.satelliteSwitch.offset && config.satelliteSwitch.offset.length > 0) {
|
|
971
|
-
if (location ==
|
|
972
|
-
$(
|
|
977
|
+
if (location == "RT") {
|
|
978
|
+
$("div.amap-maptypecontrol").css({
|
|
973
979
|
right: config.satelliteSwitch.offset[0],
|
|
974
980
|
top: config.satelliteSwitch.offset[1],
|
|
975
|
-
left:
|
|
976
|
-
bottom:
|
|
981
|
+
left: "inherit",
|
|
982
|
+
bottom: "inherit"
|
|
977
983
|
});
|
|
978
|
-
} else if (location ==
|
|
979
|
-
$(
|
|
984
|
+
} else if (location == "LT") {
|
|
985
|
+
$("div.amap-maptypecontrol").css({
|
|
980
986
|
left: config.satelliteSwitch.offset[0] + 64,
|
|
981
987
|
top: config.satelliteSwitch.offset[1],
|
|
982
|
-
right:
|
|
983
|
-
bottom:
|
|
988
|
+
right: "inherit",
|
|
989
|
+
bottom: "inherit"
|
|
984
990
|
});
|
|
985
|
-
} else if (location ==
|
|
986
|
-
$(
|
|
991
|
+
} else if (location == "LB") {
|
|
992
|
+
$("div.amap-maptypecontrol").css({
|
|
987
993
|
left: config.satelliteSwitch.offset[0] + 64,
|
|
988
994
|
bottom: config.satelliteSwitch.offset[1] + 84,
|
|
989
|
-
right:
|
|
990
|
-
top:
|
|
995
|
+
right: "inherit",
|
|
996
|
+
top: "inherit"
|
|
991
997
|
});
|
|
992
|
-
} else if (location ==
|
|
993
|
-
$(
|
|
998
|
+
} else if (location == "RB") {
|
|
999
|
+
$("div.amap-maptypecontrol").css({
|
|
994
1000
|
right: config.satelliteSwitch.offset[0],
|
|
995
1001
|
bottom: config.satelliteSwitch.offset[1] + 84,
|
|
996
|
-
left:
|
|
997
|
-
top:
|
|
1002
|
+
left: "inherit",
|
|
1003
|
+
top: "inherit"
|
|
998
1004
|
});
|
|
999
1005
|
}
|
|
1000
1006
|
}
|
|
1001
1007
|
}
|
|
1002
|
-
if ($(
|
|
1008
|
+
if ($("div.amap-maptypecontrol").length > 0) {
|
|
1003
1009
|
reloaction();
|
|
1004
1010
|
} else {
|
|
1005
1011
|
var timer = setInterval(function () {
|
|
1006
|
-
|
|
1007
|
-
if ($('div.amap-maptypecontrol').length > 0) {
|
|
1012
|
+
if ($("div.amap-maptypecontrol").length > 0) {
|
|
1008
1013
|
clearInterval(timer);
|
|
1009
1014
|
reloaction();
|
|
1010
1015
|
}
|
|
@@ -1033,7 +1038,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1033
1038
|
_extent = _t$dealData2._extent,
|
|
1034
1039
|
path = _t$dealData2.path;
|
|
1035
1040
|
switch (gp.geometryType) {
|
|
1036
|
-
case
|
|
1041
|
+
case "point":
|
|
1037
1042
|
lng = gg.getPosition().getLng();
|
|
1038
1043
|
lat = gg.getPosition().getLat();
|
|
1039
1044
|
p = _objectSpread(_objectSpread({}, gp), {}, {
|
|
@@ -1052,7 +1057,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1052
1057
|
})
|
|
1053
1058
|
});
|
|
1054
1059
|
break;
|
|
1055
|
-
case
|
|
1060
|
+
case "polyline":
|
|
1056
1061
|
pts = gg.getPath().map(function (item, index) {
|
|
1057
1062
|
return [item.lng, item.lat];
|
|
1058
1063
|
});
|
|
@@ -1071,7 +1076,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1071
1076
|
})
|
|
1072
1077
|
});
|
|
1073
1078
|
break;
|
|
1074
|
-
case
|
|
1079
|
+
case "polygon":
|
|
1075
1080
|
pts = gg.getPath().map(function (item, index) {
|
|
1076
1081
|
return [item.lng, item.lat];
|
|
1077
1082
|
});
|
|
@@ -1090,7 +1095,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1090
1095
|
})
|
|
1091
1096
|
});
|
|
1092
1097
|
break;
|
|
1093
|
-
case
|
|
1098
|
+
case "circle":
|
|
1094
1099
|
lng = gg.getCenter().getLng();
|
|
1095
1100
|
lat = gg.getCenter().getLat();
|
|
1096
1101
|
var radius = gg.getRadius();
|
|
@@ -1137,8 +1142,8 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1137
1142
|
var t = this;
|
|
1138
1143
|
bdNames.forEach(function (name) {
|
|
1139
1144
|
t.districeSearch.search(name, function (status, result) {
|
|
1140
|
-
if (status ==
|
|
1141
|
-
var id =
|
|
1145
|
+
if (status == "complete") {
|
|
1146
|
+
var id = "boundary" + new Date().getTime();
|
|
1142
1147
|
var paths = result.districtList[0].boundaries[0].map(function (item, index) {
|
|
1143
1148
|
return [item.lng, item.lat];
|
|
1144
1149
|
});
|
|
@@ -1169,7 +1174,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1169
1174
|
})
|
|
1170
1175
|
});
|
|
1171
1176
|
removedBDIds.forEach(function (id) {
|
|
1172
|
-
_this2.removeGraphic(id,
|
|
1177
|
+
_this2.removeGraphic(id, "polygon");
|
|
1173
1178
|
});
|
|
1174
1179
|
}
|
|
1175
1180
|
}, {
|
|
@@ -1217,7 +1222,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1217
1222
|
if (d.config) {
|
|
1218
1223
|
cg = _objectSpread(_objectSpread({}, cg), d.config);
|
|
1219
1224
|
}
|
|
1220
|
-
var sContent = document.createElement(
|
|
1225
|
+
var sContent = document.createElement("div");
|
|
1221
1226
|
var infowindow = new AMap.InfoWindow({
|
|
1222
1227
|
// isCustom: true,
|
|
1223
1228
|
content: sContent
|
|
@@ -1253,10 +1258,10 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1253
1258
|
//创建海量点图层
|
|
1254
1259
|
//加上mapId 实现多地图
|
|
1255
1260
|
t.pointCollectionId = "".concat(t.state.mapId, "_").concat(t.pointCollectionId);
|
|
1256
|
-
var pointCollectionHtml = document.createElement(
|
|
1261
|
+
var pointCollectionHtml = document.createElement("div");
|
|
1257
1262
|
pointCollectionHtml.id = t.pointCollectionId;
|
|
1258
|
-
pointCollectionHtml
|
|
1259
|
-
pointCollectionHtml.className =
|
|
1263
|
+
pointCollectionHtml.class = "vtx_gmap_html_pointCollection_a";
|
|
1264
|
+
pointCollectionHtml.className = "vtx_gmap_html_pointCollection_a";
|
|
1260
1265
|
$($("#".concat(t.state.mapId, " .amap-layers"))[0]).append(pointCollectionHtml);
|
|
1261
1266
|
} else {}
|
|
1262
1267
|
data.map(function (item, index) {
|
|
@@ -1354,7 +1359,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1354
1359
|
var cg = {
|
|
1355
1360
|
width: 30,
|
|
1356
1361
|
height: 30,
|
|
1357
|
-
labelContent:
|
|
1362
|
+
labelContent: "",
|
|
1358
1363
|
labelPixelX: 0,
|
|
1359
1364
|
labelPixelY: 34,
|
|
1360
1365
|
markerContentX: -13,
|
|
@@ -1373,18 +1378,18 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1373
1378
|
zIndex: cg.zIndex,
|
|
1374
1379
|
angle: cg.deg,
|
|
1375
1380
|
clickable: true,
|
|
1376
|
-
cursor:
|
|
1381
|
+
cursor: "pointer",
|
|
1377
1382
|
bubble: true,
|
|
1378
1383
|
extData: {
|
|
1379
1384
|
id: item.id
|
|
1380
1385
|
}
|
|
1381
1386
|
};
|
|
1382
1387
|
if (cg.BAnimationType == 0) {
|
|
1383
|
-
markerOption.animation =
|
|
1388
|
+
markerOption.animation = "AMAP_ANIMATION_BOUNCE";
|
|
1384
1389
|
} else if (cg.BAnimationType == 1) {
|
|
1385
|
-
markerOption.animation =
|
|
1390
|
+
markerOption.animation = "AMAP_ANIMATION_DROP";
|
|
1386
1391
|
} else {
|
|
1387
|
-
markerOption.animation =
|
|
1392
|
+
markerOption.animation = "AMAP_ANIMATION_NONE";
|
|
1388
1393
|
}
|
|
1389
1394
|
//判断html还是图片
|
|
1390
1395
|
if (!!item.markerContent) {
|
|
@@ -1405,7 +1410,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1405
1410
|
}
|
|
1406
1411
|
//是否展示label
|
|
1407
1412
|
if (item.canShowLabel) {
|
|
1408
|
-
var labelClass = item.labelClass ||
|
|
1413
|
+
var labelClass = item.labelClass || "label-content";
|
|
1409
1414
|
markerOption.label = {
|
|
1410
1415
|
content: "<div class='".concat(labelClass, "'>").concat(cg.labelContent, "</div>"),
|
|
1411
1416
|
offset: new AMap.Pixel(cg.labelPixelX, cg.labelPixelY)
|
|
@@ -1414,13 +1419,13 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1414
1419
|
//获得覆盖物对象
|
|
1415
1420
|
var marker = new AMap.Marker(markerOption);
|
|
1416
1421
|
//添加点击事件
|
|
1417
|
-
marker.on(
|
|
1422
|
+
marker.on("click", function (e) {
|
|
1418
1423
|
t.clickGraphic(item.id, e);
|
|
1419
1424
|
});
|
|
1420
|
-
marker.on(
|
|
1425
|
+
marker.on("mouseover", function (e) {
|
|
1421
1426
|
t.mouseOverGraphic(item.id, e);
|
|
1422
1427
|
});
|
|
1423
|
-
marker.on(
|
|
1428
|
+
marker.on("mouseout", function (e) {
|
|
1424
1429
|
t.mouseOutGraphic(item.id, e);
|
|
1425
1430
|
});
|
|
1426
1431
|
ps.push(marker);
|
|
@@ -1430,9 +1435,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1430
1435
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
1431
1436
|
other: item
|
|
1432
1437
|
}),
|
|
1433
|
-
geometryType:
|
|
1438
|
+
geometryType: "point",
|
|
1434
1439
|
geometry: {
|
|
1435
|
-
type:
|
|
1440
|
+
type: "point",
|
|
1436
1441
|
x: item.longitude,
|
|
1437
1442
|
y: item.latitude
|
|
1438
1443
|
}
|
|
@@ -1440,7 +1445,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1440
1445
|
});
|
|
1441
1446
|
//统一加点
|
|
1442
1447
|
t.state.gis.add(ps);
|
|
1443
|
-
if (type !==
|
|
1448
|
+
if (type !== "defined") {
|
|
1444
1449
|
t.state.pointIds = psids;
|
|
1445
1450
|
// t.setState({
|
|
1446
1451
|
// pointIds: psids
|
|
@@ -1472,7 +1477,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1472
1477
|
markerContentY: gc.getOffset().getY(),
|
|
1473
1478
|
deg: gc.getAngle(),
|
|
1474
1479
|
zIndex: gc.getzIndex(),
|
|
1475
|
-
labelClass:
|
|
1480
|
+
labelClass: "label-content"
|
|
1476
1481
|
};
|
|
1477
1482
|
if (item.config) {
|
|
1478
1483
|
cg = _objectSpread(_objectSpread({}, cg), item.config);
|
|
@@ -1482,7 +1487,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1482
1487
|
cg.labelPixelX = cg.labelPixelX || gc.getLabel() ? gc.getLabel().offset.getX() : 0;
|
|
1483
1488
|
cg.labelPixelY = cg.labelPixelY || gc.getLabel() ? gc.getLabel().offset.getY() : 34;
|
|
1484
1489
|
cg.labelContent = cg.labelContent || gc.getLabel().offset.content;
|
|
1485
|
-
var labelClass = item.labelClass ||
|
|
1490
|
+
var labelClass = item.labelClass || "label-content";
|
|
1486
1491
|
//更新label
|
|
1487
1492
|
gc.setLabel({
|
|
1488
1493
|
content: "<div class='".concat(labelClass, "'>").concat(cg.labelContent, "</div>"),
|
|
@@ -1517,11 +1522,11 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1517
1522
|
}
|
|
1518
1523
|
}
|
|
1519
1524
|
if (item.config.BAnimationType == 0) {
|
|
1520
|
-
gc.setAnimation(
|
|
1525
|
+
gc.setAnimation("AMAP_ANIMATION_BOUNCE");
|
|
1521
1526
|
} else if (item.config.BAnimationType == 1) {
|
|
1522
|
-
gc.setAnimation(
|
|
1527
|
+
gc.setAnimation("AMAP_ANIMATION_DROP");
|
|
1523
1528
|
} else {
|
|
1524
|
-
gc.setAnimation(
|
|
1529
|
+
gc.setAnimation("AMAP_ANIMATION_NONE");
|
|
1525
1530
|
}
|
|
1526
1531
|
//判断html还是图片
|
|
1527
1532
|
if (!!item.markerContent) {
|
|
@@ -1547,9 +1552,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1547
1552
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
1548
1553
|
other: item
|
|
1549
1554
|
}),
|
|
1550
|
-
geometryType:
|
|
1555
|
+
geometryType: "point",
|
|
1551
1556
|
geometry: {
|
|
1552
|
-
type:
|
|
1557
|
+
type: "point",
|
|
1553
1558
|
x: item.longitude,
|
|
1554
1559
|
y: item.latitude
|
|
1555
1560
|
}
|
|
@@ -1581,10 +1586,10 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1581
1586
|
return false;
|
|
1582
1587
|
}
|
|
1583
1588
|
var cg = {
|
|
1584
|
-
color:
|
|
1589
|
+
color: "#277ffa",
|
|
1585
1590
|
pellucidity: 0.9,
|
|
1586
1591
|
lineWidth: 5,
|
|
1587
|
-
lineType:
|
|
1592
|
+
lineType: "solid",
|
|
1588
1593
|
isHidden: false
|
|
1589
1594
|
};
|
|
1590
1595
|
if (item.config) {
|
|
@@ -1598,18 +1603,18 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1598
1603
|
path: (item.paths || []).map(function (itt, indd) {
|
|
1599
1604
|
return _toConsumableArray(itt);
|
|
1600
1605
|
}),
|
|
1601
|
-
cursor:
|
|
1606
|
+
cursor: "pointer",
|
|
1602
1607
|
bubble: true
|
|
1603
1608
|
};
|
|
1604
1609
|
var polyline = new AMap.Polyline(lineOption);
|
|
1605
1610
|
//添加点击事件
|
|
1606
|
-
polyline.on(
|
|
1611
|
+
polyline.on("click", function (e) {
|
|
1607
1612
|
t.clickGraphic(item.id, e);
|
|
1608
1613
|
});
|
|
1609
|
-
polyline.on(
|
|
1614
|
+
polyline.on("mouseover", function (e) {
|
|
1610
1615
|
t.mouseOverGraphic(item.id, e);
|
|
1611
1616
|
});
|
|
1612
|
-
polyline.on(
|
|
1617
|
+
polyline.on("mouseout", function (e) {
|
|
1613
1618
|
t.mouseOutGraphic(item.id, e);
|
|
1614
1619
|
});
|
|
1615
1620
|
//缓存图元的数据,便于后期操作
|
|
@@ -1621,9 +1626,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1621
1626
|
paths: pts,
|
|
1622
1627
|
other: item
|
|
1623
1628
|
}),
|
|
1624
|
-
geometryType:
|
|
1629
|
+
geometryType: "polyline",
|
|
1625
1630
|
geometry: {
|
|
1626
|
-
type:
|
|
1631
|
+
type: "polyline",
|
|
1627
1632
|
paths: pts
|
|
1628
1633
|
}
|
|
1629
1634
|
});
|
|
@@ -1651,7 +1656,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1651
1656
|
// });
|
|
1652
1657
|
});
|
|
1653
1658
|
t.state.gis.add(ls);
|
|
1654
|
-
if (type !==
|
|
1659
|
+
if (type !== "defined") {
|
|
1655
1660
|
t.state.lineIds = lsids;
|
|
1656
1661
|
// t.setState({
|
|
1657
1662
|
// lineIds: lsids
|
|
@@ -1702,7 +1707,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1702
1707
|
path: (item.paths || op.path).map(function (itt, indd) {
|
|
1703
1708
|
return _toConsumableArray(itt);
|
|
1704
1709
|
}),
|
|
1705
|
-
cursor:
|
|
1710
|
+
cursor: "pointer"
|
|
1706
1711
|
};
|
|
1707
1712
|
var pts = item.paths.map(function (itt, ind) {
|
|
1708
1713
|
return _toConsumableArray(itt);
|
|
@@ -1712,9 +1717,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1712
1717
|
paths: pts,
|
|
1713
1718
|
other: item
|
|
1714
1719
|
}),
|
|
1715
|
-
geometryType:
|
|
1720
|
+
geometryType: "polyline",
|
|
1716
1721
|
geometry: {
|
|
1717
|
-
type:
|
|
1722
|
+
type: "polyline",
|
|
1718
1723
|
paths: pts
|
|
1719
1724
|
}
|
|
1720
1725
|
});
|
|
@@ -1747,11 +1752,11 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1747
1752
|
return false;
|
|
1748
1753
|
}
|
|
1749
1754
|
var cg = {
|
|
1750
|
-
lineType:
|
|
1755
|
+
lineType: "solid",
|
|
1751
1756
|
lineWidth: 5,
|
|
1752
|
-
lineColor:
|
|
1757
|
+
lineColor: "#277ffa",
|
|
1753
1758
|
lineOpacity: 1,
|
|
1754
|
-
color:
|
|
1759
|
+
color: "#fff",
|
|
1755
1760
|
pellucidity: 0.5
|
|
1756
1761
|
// isHidden: false //后期跟百度一起加
|
|
1757
1762
|
};
|
|
@@ -1768,18 +1773,18 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1768
1773
|
path: (item.rings || []).map(function (itt, indd) {
|
|
1769
1774
|
return _toConsumableArray(itt);
|
|
1770
1775
|
}),
|
|
1771
|
-
cursor:
|
|
1776
|
+
cursor: "pointer",
|
|
1772
1777
|
bubble: true
|
|
1773
1778
|
};
|
|
1774
1779
|
var polygon = new AMap.Polygon(polygonOption);
|
|
1775
1780
|
//添加点击事件
|
|
1776
|
-
polygon.on(
|
|
1781
|
+
polygon.on("click", function (e) {
|
|
1777
1782
|
t.clickGraphic(item.id, e);
|
|
1778
1783
|
});
|
|
1779
|
-
polygon.on(
|
|
1784
|
+
polygon.on("mouseover", function (e) {
|
|
1780
1785
|
t.mouseOverGraphic(item.id, e);
|
|
1781
1786
|
});
|
|
1782
|
-
polygon.on(
|
|
1787
|
+
polygon.on("mouseout", function (e) {
|
|
1783
1788
|
t.mouseOutGraphic(item.id, e);
|
|
1784
1789
|
});
|
|
1785
1790
|
//缓存图元的数据,便于后期操作
|
|
@@ -1791,9 +1796,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1791
1796
|
rings: pts,
|
|
1792
1797
|
other: item
|
|
1793
1798
|
}),
|
|
1794
|
-
geometryType:
|
|
1799
|
+
geometryType: "polygon",
|
|
1795
1800
|
geometry: {
|
|
1796
|
-
type:
|
|
1801
|
+
type: "polygon",
|
|
1797
1802
|
rings: pts
|
|
1798
1803
|
}
|
|
1799
1804
|
});
|
|
@@ -1853,7 +1858,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1853
1858
|
path: (item.rings || op.path).map(function (itt, indd) {
|
|
1854
1859
|
return _toConsumableArray(itt);
|
|
1855
1860
|
}),
|
|
1856
|
-
cursor:
|
|
1861
|
+
cursor: "pointer"
|
|
1857
1862
|
};
|
|
1858
1863
|
var pts = item.rings.map(function (itt, ind) {
|
|
1859
1864
|
return _toConsumableArray(itt);
|
|
@@ -1863,9 +1868,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1863
1868
|
rings: pts,
|
|
1864
1869
|
other: item
|
|
1865
1870
|
}),
|
|
1866
|
-
geometryType:
|
|
1871
|
+
geometryType: "polygon",
|
|
1867
1872
|
geometry: {
|
|
1868
|
-
type:
|
|
1873
|
+
type: "polygon",
|
|
1869
1874
|
rings: pts
|
|
1870
1875
|
}
|
|
1871
1876
|
});
|
|
@@ -1897,11 +1902,11 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1897
1902
|
return false;
|
|
1898
1903
|
}
|
|
1899
1904
|
var cg = {
|
|
1900
|
-
lineType:
|
|
1905
|
+
lineType: "solid",
|
|
1901
1906
|
lineWidth: 5,
|
|
1902
|
-
lineColor:
|
|
1907
|
+
lineColor: "#277ffa",
|
|
1903
1908
|
lineOpacity: 1,
|
|
1904
|
-
color:
|
|
1909
|
+
color: "#fff",
|
|
1905
1910
|
pellucidity: 0.5
|
|
1906
1911
|
// isHidden: false //后期跟百度一起加
|
|
1907
1912
|
};
|
|
@@ -1918,19 +1923,19 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1918
1923
|
fillOpacity: cg.pellucidity,
|
|
1919
1924
|
center: new AMap.LngLat(item.longitude, item.latitude),
|
|
1920
1925
|
radius: item.radius,
|
|
1921
|
-
cursor:
|
|
1926
|
+
cursor: "pointer",
|
|
1922
1927
|
bubble: true
|
|
1923
1928
|
};
|
|
1924
1929
|
//创建圆对象
|
|
1925
1930
|
var circle = new AMap.Circle(circleOption);
|
|
1926
1931
|
//添加点击事件
|
|
1927
|
-
circle.on(
|
|
1932
|
+
circle.on("click", function (e) {
|
|
1928
1933
|
t.clickGraphic(item.id, e);
|
|
1929
1934
|
});
|
|
1930
|
-
circle.on(
|
|
1935
|
+
circle.on("mouseover", function (e) {
|
|
1931
1936
|
t.mouseOverGraphic(item.id, e);
|
|
1932
1937
|
});
|
|
1933
|
-
circle.on(
|
|
1938
|
+
circle.on("mouseout", function (e) {
|
|
1934
1939
|
t.mouseOutGraphic(item.id, e);
|
|
1935
1940
|
});
|
|
1936
1941
|
//缓存图元的数据,便于后期操作
|
|
@@ -1938,9 +1943,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1938
1943
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
1939
1944
|
other: item
|
|
1940
1945
|
}),
|
|
1941
|
-
geometryType:
|
|
1946
|
+
geometryType: "circle",
|
|
1942
1947
|
geometry: {
|
|
1943
|
-
type:
|
|
1948
|
+
type: "circle",
|
|
1944
1949
|
x: item.longitude,
|
|
1945
1950
|
y: item.latitude,
|
|
1946
1951
|
radius: item.radius
|
|
@@ -1959,18 +1964,18 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1959
1964
|
}, {
|
|
1960
1965
|
key: "updateCircle",
|
|
1961
1966
|
value: function updateCircle(mapCircles) {
|
|
1962
|
-
var
|
|
1967
|
+
var _this10 = this;
|
|
1963
1968
|
var t = this;
|
|
1964
1969
|
mapCircles.map(function (item, index) {
|
|
1965
1970
|
//判断图元是否存在.
|
|
1966
|
-
if (
|
|
1971
|
+
if (_this10.GM.isRepetition(item.id)) {
|
|
1967
1972
|
//圆 点位数据不符合,直接跳过
|
|
1968
1973
|
if (!item.longitude || !item.latitude) {
|
|
1969
1974
|
console.warn("\u5706 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
|
|
1970
1975
|
return false;
|
|
1971
1976
|
}
|
|
1972
1977
|
//获取原有的图元
|
|
1973
|
-
var gc =
|
|
1978
|
+
var gc = _this10.GM.getGraphic(item.id);
|
|
1974
1979
|
var op = gc.getOptions();
|
|
1975
1980
|
//获取原有的面属性,转换key值
|
|
1976
1981
|
var cg = {
|
|
@@ -1995,16 +2000,16 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1995
2000
|
fillOpacity: cg.pellucidity,
|
|
1996
2001
|
center: new AMap.LngLat(item.longitude, item.latitude) || op.center,
|
|
1997
2002
|
radius: !item.radius && item != 0 ? op.radius : item.radius,
|
|
1998
|
-
cursor:
|
|
2003
|
+
cursor: "pointer"
|
|
1999
2004
|
};
|
|
2000
2005
|
//缓存图元的数据,便于后期操作
|
|
2001
|
-
|
|
2006
|
+
_this10.GM.setGraphicParam(item.id, {
|
|
2002
2007
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2003
2008
|
other: item
|
|
2004
2009
|
}),
|
|
2005
|
-
geometryType:
|
|
2010
|
+
geometryType: "circle",
|
|
2006
2011
|
geometry: {
|
|
2007
|
-
type:
|
|
2012
|
+
type: "circle",
|
|
2008
2013
|
x: item.longitude,
|
|
2009
2014
|
y: item.latitude,
|
|
2010
2015
|
radius: item.radius
|
|
@@ -2031,23 +2036,23 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2031
2036
|
t.endEdit();
|
|
2032
2037
|
}
|
|
2033
2038
|
switch (ms.geometryType) {
|
|
2034
|
-
case
|
|
2039
|
+
case "point":
|
|
2035
2040
|
ms.mapLayer.setDraggable(true);
|
|
2036
|
-
ms.mapLayer.on(
|
|
2041
|
+
ms.mapLayer.on("dragend", t.editGraphicChange, t);
|
|
2037
2042
|
break;
|
|
2038
|
-
case
|
|
2043
|
+
case "polyline":
|
|
2039
2044
|
// break;
|
|
2040
|
-
case
|
|
2041
|
-
case
|
|
2045
|
+
case "polygon":
|
|
2046
|
+
case "rectangle":
|
|
2042
2047
|
t.polyEdit = new AMap.PolyEditor(t.state.gis, ms.mapLayer);
|
|
2043
2048
|
t.polyEdit.open();
|
|
2044
|
-
t.polyEdit.on(
|
|
2049
|
+
t.polyEdit.on("adjust", t.editGraphicChange, t);
|
|
2045
2050
|
break;
|
|
2046
|
-
case
|
|
2051
|
+
case "circle":
|
|
2047
2052
|
t.circleEdit = new AMap.CircleEditor(t.state.gis, ms.mapLayer);
|
|
2048
2053
|
t.circleEdit.open();
|
|
2049
|
-
t.circleEdit.on(
|
|
2050
|
-
t.circleEdit.on(
|
|
2054
|
+
t.circleEdit.on("move", t.editGraphicChange, t);
|
|
2055
|
+
t.circleEdit.on("adjust", t.editGraphicChange, t);
|
|
2051
2056
|
break;
|
|
2052
2057
|
}
|
|
2053
2058
|
t.setState({
|
|
@@ -2061,27 +2066,27 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2061
2066
|
var t = this;
|
|
2062
2067
|
var ms = t.getGraphic(t.state.editId);
|
|
2063
2068
|
switch (ms.geometryType) {
|
|
2064
|
-
case
|
|
2069
|
+
case "point":
|
|
2065
2070
|
ms.mapLayer.setDraggable(false);
|
|
2066
|
-
ms.mapLayer.off(
|
|
2071
|
+
ms.mapLayer.off("dragend", t.editGraphicChange, t);
|
|
2067
2072
|
break;
|
|
2068
|
-
case
|
|
2069
|
-
case
|
|
2070
|
-
case
|
|
2073
|
+
case "polyline":
|
|
2074
|
+
case "polygon":
|
|
2075
|
+
case "rectangle":
|
|
2071
2076
|
t.polyEdit.close();
|
|
2072
|
-
t.polyEdit.off(
|
|
2077
|
+
t.polyEdit.off("adjust", t.editGraphicChange, t);
|
|
2073
2078
|
break;
|
|
2074
|
-
case
|
|
2079
|
+
case "circle":
|
|
2075
2080
|
t.circleEdit.close();
|
|
2076
|
-
t.circleEdit.off(
|
|
2077
|
-
t.circleEdit.off(
|
|
2081
|
+
t.circleEdit.off("move", t.editGraphicChange, t);
|
|
2082
|
+
t.circleEdit.off("adjust", t.editGraphicChange, t);
|
|
2078
2083
|
break;
|
|
2079
2084
|
}
|
|
2080
2085
|
var editGraphic = t.state.editGraphic;
|
|
2081
2086
|
if (editGraphic) {
|
|
2082
2087
|
t.setState({
|
|
2083
|
-
editId:
|
|
2084
|
-
editGraphic:
|
|
2088
|
+
editId: "",
|
|
2089
|
+
editGraphic: ""
|
|
2085
2090
|
}, function () {
|
|
2086
2091
|
t.props.editGraphicChange(editGraphic);
|
|
2087
2092
|
});
|
|
@@ -2098,26 +2103,26 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2098
2103
|
e: e
|
|
2099
2104
|
};
|
|
2100
2105
|
switch (ms.geometryType) {
|
|
2101
|
-
case
|
|
2106
|
+
case "point":
|
|
2102
2107
|
obj.geometry = ms.geometry;
|
|
2103
2108
|
obj.param = ms;
|
|
2104
2109
|
break;
|
|
2105
|
-
case
|
|
2110
|
+
case "polyline":
|
|
2106
2111
|
obj.geometry = ms.geometry;
|
|
2107
2112
|
obj.param = ms;
|
|
2108
2113
|
obj.distance = ms.mapLayer.getLength();
|
|
2109
2114
|
break;
|
|
2110
|
-
case
|
|
2111
|
-
case
|
|
2115
|
+
case "polygon":
|
|
2116
|
+
case "rectangle":
|
|
2112
2117
|
obj.geometry = ms.geometry;
|
|
2113
2118
|
obj.param = ms;
|
|
2114
2119
|
obj.area = e.target.getArea();
|
|
2115
2120
|
break;
|
|
2116
|
-
case
|
|
2117
|
-
if (!(
|
|
2121
|
+
case "circle":
|
|
2122
|
+
if (!("lnglat" in e)) {
|
|
2118
2123
|
obj.e.lnglat = new AMap.LngLat(ms.geometry.x, ms.geometry.y);
|
|
2119
2124
|
}
|
|
2120
|
-
if (!(
|
|
2125
|
+
if (!("radius" in e)) {
|
|
2121
2126
|
obj.e.radius = ms.geometry.radius;
|
|
2122
2127
|
}
|
|
2123
2128
|
obj.geometry = ms.geometry;
|
|
@@ -2125,7 +2130,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2125
2130
|
obj.area = Math.pow(ms.geometry.radius, 2) * Math.PI;
|
|
2126
2131
|
break;
|
|
2127
2132
|
}
|
|
2128
|
-
if (ms.geometryType ==
|
|
2133
|
+
if (ms.geometryType == "circle") {
|
|
2129
2134
|
if (t.editTimeout) {
|
|
2130
2135
|
clearTimeout(t.editTimeout);
|
|
2131
2136
|
}
|
|
@@ -2173,7 +2178,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2173
2178
|
value: function dragMapStart() {
|
|
2174
2179
|
var t = this;
|
|
2175
2180
|
if (typeof t.props.dragMapStart === "function") {
|
|
2176
|
-
t.state.gis.on(
|
|
2181
|
+
t.state.gis.on("dragstart", function (e) {
|
|
2177
2182
|
var obj = t.getMapExtent();
|
|
2178
2183
|
obj.e = e;
|
|
2179
2184
|
//处理下数据,符合拖拽事件
|
|
@@ -2187,7 +2192,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2187
2192
|
value: function dragMapEnd() {
|
|
2188
2193
|
var t = this;
|
|
2189
2194
|
if (typeof t.props.dragMapEnd === "function") {
|
|
2190
|
-
t.state.gis.on(
|
|
2195
|
+
t.state.gis.on("dragend", function (e) {
|
|
2191
2196
|
var obj = t.getMapExtent();
|
|
2192
2197
|
obj.e = e;
|
|
2193
2198
|
//处理下数据,符合拖拽事件
|
|
@@ -2201,16 +2206,16 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2201
2206
|
value: function moveStart() {
|
|
2202
2207
|
var t = this;
|
|
2203
2208
|
if (typeof t.props.moveStart === "function") {
|
|
2204
|
-
t.state.gis.on(
|
|
2209
|
+
t.state.gis.on("movestart", function (e) {
|
|
2205
2210
|
t.htmlXY = _objectSpread({
|
|
2206
2211
|
px: 0,
|
|
2207
2212
|
py: 0,
|
|
2208
2213
|
isCount: true
|
|
2209
2214
|
}, t.state.gis.lnglatToPixel(t.state.gis.getCenter()));
|
|
2210
2215
|
$("#".concat(t.pointCollectionId)).css({
|
|
2211
|
-
top:
|
|
2212
|
-
left:
|
|
2213
|
-
display:
|
|
2216
|
+
top: "0px",
|
|
2217
|
+
left: "0px",
|
|
2218
|
+
display: "none"
|
|
2214
2219
|
});
|
|
2215
2220
|
t.updatePointCollection(t.props.mapPointCollection);
|
|
2216
2221
|
if (t.stopMove) {
|
|
@@ -2228,12 +2233,12 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2228
2233
|
value: function moveEnd() {
|
|
2229
2234
|
var t = this;
|
|
2230
2235
|
if (typeof t.props.moveEnd === "function") {
|
|
2231
|
-
t.state.gis.on(
|
|
2236
|
+
t.state.gis.on("moveend", function (e) {
|
|
2232
2237
|
t.htmlXY.isCount = false;
|
|
2233
2238
|
$("#".concat(t.pointCollectionId)).css({
|
|
2234
|
-
top:
|
|
2235
|
-
left:
|
|
2236
|
-
display:
|
|
2239
|
+
top: "0px",
|
|
2240
|
+
left: "0px",
|
|
2241
|
+
display: "block"
|
|
2237
2242
|
});
|
|
2238
2243
|
t.updatePointCollection(t.props.mapPointCollection);
|
|
2239
2244
|
if (t.stopMove) {
|
|
@@ -2253,9 +2258,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2253
2258
|
value: function zoomStart() {
|
|
2254
2259
|
var t = this;
|
|
2255
2260
|
if (typeof t.props.zoomStart === "function") {
|
|
2256
|
-
t.state.gis.on(
|
|
2261
|
+
t.state.gis.on("zoomstart", function (e) {
|
|
2257
2262
|
$("#".concat(t.pointCollectionId)).css({
|
|
2258
|
-
display:
|
|
2263
|
+
display: "none"
|
|
2259
2264
|
});
|
|
2260
2265
|
t.stopMove = false;
|
|
2261
2266
|
var obj = t.getMapExtent();
|
|
@@ -2270,9 +2275,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2270
2275
|
value: function zoomEnd() {
|
|
2271
2276
|
var t = this;
|
|
2272
2277
|
if (typeof t.props.zoomEnd === "function") {
|
|
2273
|
-
t.state.gis.on(
|
|
2278
|
+
t.state.gis.on("zoomend", function (e) {
|
|
2274
2279
|
$("#".concat(t.pointCollectionId)).css({
|
|
2275
|
-
display:
|
|
2280
|
+
display: "inline-block"
|
|
2276
2281
|
});
|
|
2277
2282
|
var obj = t.getMapExtent();
|
|
2278
2283
|
obj.e = e;
|
|
@@ -2285,7 +2290,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2285
2290
|
key: "mouseOverGraphic",
|
|
2286
2291
|
value: function mouseOverGraphic(id, e) {
|
|
2287
2292
|
var t = this;
|
|
2288
|
-
if (typeof t.props.mouseOverGraphic ===
|
|
2293
|
+
if (typeof t.props.mouseOverGraphic === "function") {
|
|
2289
2294
|
var obj = {
|
|
2290
2295
|
e: e,
|
|
2291
2296
|
id: id,
|
|
@@ -2320,7 +2325,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2320
2325
|
value: function clickMap() {
|
|
2321
2326
|
var t = this;
|
|
2322
2327
|
if (typeof t.props.clickMap === "function") {
|
|
2323
|
-
t.state.gis.on(
|
|
2328
|
+
t.state.gis.on("click", function (e) {
|
|
2324
2329
|
var obj = t.getMapExtent();
|
|
2325
2330
|
obj.e = e;
|
|
2326
2331
|
obj.clickLngLat = {
|
|
@@ -2342,18 +2347,18 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2342
2347
|
t.state.gis.setDefaultCursor(this.csr);
|
|
2343
2348
|
}
|
|
2344
2349
|
/*
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
+
参数
|
|
2351
|
+
geometryType:point/polyline/polygon/circle/rectangle 默认point
|
|
2352
|
+
parameter 样式 默认null 对象{}写入方式跟add方法一样(对应点线圆面)
|
|
2353
|
+
data //初始化数据 默认{id:'add'}
|
|
2354
|
+
*/
|
|
2350
2355
|
}, {
|
|
2351
2356
|
key: "draw",
|
|
2352
2357
|
value: function draw(obj) {
|
|
2353
2358
|
var t = this,
|
|
2354
2359
|
drawParam = {};
|
|
2355
2360
|
//初始化参数
|
|
2356
|
-
drawParam.geometryType = obj.geometryType ||
|
|
2361
|
+
drawParam.geometryType = obj.geometryType || "point";
|
|
2357
2362
|
drawParam.parameter = obj.parameter ? _objectSpread({}, obj.parameter) : {};
|
|
2358
2363
|
drawParam.data = obj.data ? _objectSpread({}, obj.data) : {};
|
|
2359
2364
|
drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime());
|
|
@@ -2365,10 +2370,10 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2365
2370
|
t.state.drawIds[drawParam.geometryType].splice(len, 1);
|
|
2366
2371
|
}
|
|
2367
2372
|
//引用百度测距样式
|
|
2368
|
-
t.state.gis.setDefaultCursor(
|
|
2373
|
+
t.state.gis.setDefaultCursor("crosshair");
|
|
2369
2374
|
var param = {};
|
|
2370
2375
|
var paramgcr = {};
|
|
2371
|
-
if (drawParam.geometryType ==
|
|
2376
|
+
if (drawParam.geometryType == "polygon" || drawParam.geometryType == "circle" || drawParam.geometryType == "rectangle") {
|
|
2372
2377
|
paramgcr.fillColor = drawParam.parameter.color;
|
|
2373
2378
|
paramgcr.strokeColor = drawParam.parameter.lineColor;
|
|
2374
2379
|
paramgcr.strokeOpacity = drawParam.parameter.lineOpacity;
|
|
@@ -2391,9 +2396,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2391
2396
|
};
|
|
2392
2397
|
}
|
|
2393
2398
|
switch (drawParam.geometryType) {
|
|
2394
|
-
case
|
|
2399
|
+
case "point":
|
|
2395
2400
|
param.icon = new AMap.Icon({
|
|
2396
|
-
image: drawParam.parameter.url ||
|
|
2401
|
+
image: drawParam.parameter.url || "http://webapi.amap.com/theme/v1.3/markers/n/mark_bs.png",
|
|
2397
2402
|
size: new AMap.Size(drawParam.parameter.width || 36, drawParam.parameter.height || 36),
|
|
2398
2403
|
offset: new AMap.Pixel(drawParam.parameter.labelPixelX || -10, drawParam.parameter.labelPixelY || -34)
|
|
2399
2404
|
});
|
|
@@ -2401,17 +2406,17 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2401
2406
|
id: drawParam.data.id,
|
|
2402
2407
|
attributes: {
|
|
2403
2408
|
id: drawParam.data.id,
|
|
2404
|
-
url: drawParam.parameter.url ||
|
|
2409
|
+
url: drawParam.parameter.url || "http://webapi.amap.com/theme/v1.3/markers/n/mark_bs.png",
|
|
2405
2410
|
config: {
|
|
2406
2411
|
width: drawParam.parameter.width || 36,
|
|
2407
2412
|
height: drawParam.parameter.height || 36
|
|
2408
2413
|
}
|
|
2409
2414
|
},
|
|
2410
|
-
type:
|
|
2415
|
+
type: "point"
|
|
2411
2416
|
};
|
|
2412
2417
|
t.mousetool.marker(param);
|
|
2413
2418
|
break;
|
|
2414
|
-
case
|
|
2419
|
+
case "polyline":
|
|
2415
2420
|
param.strokeColor = drawParam.parameter.color;
|
|
2416
2421
|
param.strokeOpacity = drawParam.parameter.pellucidity;
|
|
2417
2422
|
param.strokeWeight = drawParam.parameter.lineWidth;
|
|
@@ -2426,17 +2431,17 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2426
2431
|
lineWidth: drawParam.parameter.lineWidth
|
|
2427
2432
|
}
|
|
2428
2433
|
},
|
|
2429
|
-
type:
|
|
2434
|
+
type: "polyline"
|
|
2430
2435
|
};
|
|
2431
2436
|
t.mousetool.polyline(param);
|
|
2432
2437
|
break;
|
|
2433
|
-
case
|
|
2438
|
+
case "polygon":
|
|
2434
2439
|
t.mousetool.polygon(paramgcr);
|
|
2435
2440
|
break;
|
|
2436
|
-
case
|
|
2441
|
+
case "circle":
|
|
2437
2442
|
t.mousetool.circle(paramgcr);
|
|
2438
2443
|
break;
|
|
2439
|
-
case
|
|
2444
|
+
case "rectangle":
|
|
2440
2445
|
t.mousetool.rectangle(paramgcr);
|
|
2441
2446
|
break;
|
|
2442
2447
|
}
|
|
@@ -2465,7 +2470,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2465
2470
|
ymin: 0
|
|
2466
2471
|
},
|
|
2467
2472
|
path = [];
|
|
2468
|
-
if (
|
|
2473
|
+
if ("getPath" in ms) {
|
|
2469
2474
|
path = ms.getPath();
|
|
2470
2475
|
path = path.map(function (item, index) {
|
|
2471
2476
|
var lng = item.lng,
|
|
@@ -2516,19 +2521,19 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2516
2521
|
//清除 state中id的缓存
|
|
2517
2522
|
var ids = [];
|
|
2518
2523
|
switch (type) {
|
|
2519
|
-
case
|
|
2524
|
+
case "point":
|
|
2520
2525
|
ids = t.state.pointIds;
|
|
2521
2526
|
break;
|
|
2522
|
-
case
|
|
2527
|
+
case "line":
|
|
2523
2528
|
ids = t.state.lineIds;
|
|
2524
2529
|
break;
|
|
2525
|
-
case
|
|
2530
|
+
case "polygon":
|
|
2526
2531
|
ids = t.state.polygonIds;
|
|
2527
2532
|
break;
|
|
2528
|
-
case
|
|
2533
|
+
case "circle":
|
|
2529
2534
|
ids = t.state.circleIds;
|
|
2530
2535
|
break;
|
|
2531
|
-
case
|
|
2536
|
+
case "draw":
|
|
2532
2537
|
if (t.state.drawIds.point.indexOf(id) > -1) {
|
|
2533
2538
|
t.state.drawIds.point.splice(t.state.drawIds.point.indexOf(id), 1);
|
|
2534
2539
|
}
|
|
@@ -2561,7 +2566,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2561
2566
|
break;
|
|
2562
2567
|
}
|
|
2563
2568
|
if (id == t.state.editId) {
|
|
2564
|
-
t.state.editId =
|
|
2569
|
+
t.state.editId = "";
|
|
2565
2570
|
}
|
|
2566
2571
|
if (ids.indexOf(id) != -1) {
|
|
2567
2572
|
ids.splice(ids.indexOf(id), 1);
|
|
@@ -2604,7 +2609,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2604
2609
|
}, {
|
|
2605
2610
|
key: "deepEqual",
|
|
2606
2611
|
value: function deepEqual(a, b) {
|
|
2607
|
-
return _immutable
|
|
2612
|
+
return _immutable.default.is(_immutable.default.fromJS(a), _immutable.default.fromJS(b));
|
|
2608
2613
|
}
|
|
2609
2614
|
//计算2点间距离 单位m 精确到个位
|
|
2610
2615
|
}, {
|
|
@@ -2720,7 +2725,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2720
2725
|
labelContent: r.name,
|
|
2721
2726
|
labelPixelY: 27
|
|
2722
2727
|
},
|
|
2723
|
-
other:
|
|
2728
|
+
other: "search"
|
|
2724
2729
|
};
|
|
2725
2730
|
});
|
|
2726
2731
|
resolve(list);
|
|
@@ -2732,11 +2737,11 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2732
2737
|
value: function render() {
|
|
2733
2738
|
var t = this;
|
|
2734
2739
|
var _map = this.props;
|
|
2735
|
-
return /*#__PURE__*/
|
|
2740
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2736
2741
|
id: _map.mapId,
|
|
2737
2742
|
style: {
|
|
2738
|
-
width:
|
|
2739
|
-
height:
|
|
2743
|
+
width: "100%",
|
|
2744
|
+
height: "100%"
|
|
2740
2745
|
}
|
|
2741
2746
|
});
|
|
2742
2747
|
}
|
|
@@ -2759,7 +2764,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2759
2764
|
//关闭moveTo定时
|
|
2760
2765
|
var t = this;
|
|
2761
2766
|
for (var i in t.GM.allParam) {
|
|
2762
|
-
if (t.GM.allParam[i].geometryType ==
|
|
2767
|
+
if (t.GM.allParam[i].geometryType == "point") {
|
|
2763
2768
|
if (t.GM.getGraphic[i]) {
|
|
2764
2769
|
t.GM.getGraphic[i].stopMove();
|
|
2765
2770
|
}
|
|
@@ -2863,7 +2868,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2863
2868
|
// 等待地图加载
|
|
2864
2869
|
if (!t.mapCreated) return;
|
|
2865
2870
|
if (mapPointCollection instanceof Array && props.mapPointCollection instanceof Array && !t.deepEqual(mapPointCollection, t.props.mapPointCollection)) {
|
|
2866
|
-
var _t$dataMatch = t.dataMatch(t.props.mapPointCollection, mapPointCollection,
|
|
2871
|
+
var _t$dataMatch = t.dataMatch(t.props.mapPointCollection, mapPointCollection, "id"),
|
|
2867
2872
|
deletedDataIDs = _t$dataMatch.deletedDataIDs,
|
|
2868
2873
|
addedData = _t$dataMatch.addedData,
|
|
2869
2874
|
updatedData = _t$dataMatch.updatedData;
|
|
@@ -2871,14 +2876,14 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2871
2876
|
t.addPointCollection(addedData);
|
|
2872
2877
|
t.updatePointCollection(updatedData);
|
|
2873
2878
|
}
|
|
2874
|
-
if (typeof isclearAllPointCollection ==
|
|
2879
|
+
if (typeof isclearAllPointCollection == "boolean" && isclearAllPointCollection || isclearAllPointCollection && isclearAllPointCollection !== t.props.isclearAllPointCollection) {
|
|
2875
2880
|
t.clearAllPointCollection();
|
|
2876
2881
|
}
|
|
2877
2882
|
/*点数据处理
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2883
|
+
pointData[2]相同的点,执行刷新
|
|
2884
|
+
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
2885
|
+
pointData[0]数据中多余的id,执行删除
|
|
2886
|
+
*/
|
|
2882
2887
|
if (mapPoints instanceof Array && props.mapPoints instanceof Array && !t.deepEqual(mapPoints, props.mapPoints)) {
|
|
2883
2888
|
var oldMapPoints = props.mapPoints;
|
|
2884
2889
|
var newMapPoints = mapPoints;
|
|
@@ -2891,7 +2896,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2891
2896
|
return item.id !== editGraphicId;
|
|
2892
2897
|
});
|
|
2893
2898
|
}
|
|
2894
|
-
var _t$dataMatch2 = t.dataMatch(oldMapPoints, newMapPoints,
|
|
2899
|
+
var _t$dataMatch2 = t.dataMatch(oldMapPoints, newMapPoints, "id"),
|
|
2895
2900
|
_deletedDataIDs = _t$dataMatch2.deletedDataIDs,
|
|
2896
2901
|
_addedData = _t$dataMatch2.addedData,
|
|
2897
2902
|
_updatedData = _t$dataMatch2.updatedData;
|
|
@@ -2907,7 +2912,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2907
2912
|
try {
|
|
2908
2913
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2909
2914
|
var id = _step.value;
|
|
2910
|
-
t.removeGraphic(id,
|
|
2915
|
+
t.removeGraphic(id, "point");
|
|
2911
2916
|
}
|
|
2912
2917
|
//增加
|
|
2913
2918
|
} catch (err) {
|
|
@@ -2920,9 +2925,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2920
2925
|
t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
|
|
2921
2926
|
}
|
|
2922
2927
|
/*
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2928
|
+
面数据处理
|
|
2929
|
+
先全删除,再新增
|
|
2930
|
+
*/
|
|
2926
2931
|
if (mapPolygons instanceof Array && props.mapPolygons instanceof Array && !t.deepEqual(mapPolygons, props.mapPolygons)) {
|
|
2927
2932
|
var oldMapPolygons = props.mapPolygons;
|
|
2928
2933
|
var newMapPolygons = mapPolygons;
|
|
@@ -2934,7 +2939,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2934
2939
|
return item.id !== editGraphicId;
|
|
2935
2940
|
});
|
|
2936
2941
|
}
|
|
2937
|
-
var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons,
|
|
2942
|
+
var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons, "id"),
|
|
2938
2943
|
_deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
|
|
2939
2944
|
_addedData2 = _t$dataMatch3.addedData,
|
|
2940
2945
|
_updatedData2 = _t$dataMatch3.updatedData;
|
|
@@ -2950,7 +2955,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2950
2955
|
try {
|
|
2951
2956
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2952
2957
|
var _id = _step2.value;
|
|
2953
|
-
t.removeGraphic(_id,
|
|
2958
|
+
t.removeGraphic(_id, "polygon");
|
|
2954
2959
|
}
|
|
2955
2960
|
//增加
|
|
2956
2961
|
} catch (err) {
|
|
@@ -2963,9 +2968,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2963
2968
|
t.updatePolygon([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
|
|
2964
2969
|
}
|
|
2965
2970
|
/*
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2971
|
+
面数据处理
|
|
2972
|
+
先全删除,再新增
|
|
2973
|
+
*/
|
|
2969
2974
|
if (mapCircles instanceof Array && props.mapCircles instanceof Array && !t.deepEqual(mapCircles, props.mapCircles)) {
|
|
2970
2975
|
var oldMapCircles = props.mapCircles;
|
|
2971
2976
|
var newMapCircles = mapCircles;
|
|
@@ -2977,7 +2982,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2977
2982
|
return item.id !== editGraphicId;
|
|
2978
2983
|
});
|
|
2979
2984
|
}
|
|
2980
|
-
var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles,
|
|
2985
|
+
var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles, "id"),
|
|
2981
2986
|
_deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
|
|
2982
2987
|
_addedData3 = _t$dataMatch4.addedData,
|
|
2983
2988
|
_updatedData3 = _t$dataMatch4.updatedData;
|
|
@@ -2993,7 +2998,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2993
2998
|
try {
|
|
2994
2999
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2995
3000
|
var _id2 = _step3.value;
|
|
2996
|
-
t.removeGraphic(_id2,
|
|
3001
|
+
t.removeGraphic(_id2, "circle");
|
|
2997
3002
|
}
|
|
2998
3003
|
//增加
|
|
2999
3004
|
} catch (err) {
|
|
@@ -3006,9 +3011,9 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3006
3011
|
t.updateCircle([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
|
|
3007
3012
|
}
|
|
3008
3013
|
/*
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3014
|
+
线数据处理
|
|
3015
|
+
先全删除,再新增
|
|
3016
|
+
*/
|
|
3012
3017
|
if (mapLines instanceof Array && props.mapLines instanceof Array && !t.deepEqual(mapLines, props.mapLines)) {
|
|
3013
3018
|
var oldMapLines = props.mapLines;
|
|
3014
3019
|
var newMapLines = mapLines;
|
|
@@ -3020,7 +3025,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3020
3025
|
return item.id !== editGraphicId;
|
|
3021
3026
|
});
|
|
3022
3027
|
}
|
|
3023
|
-
var _t$dataMatch5 = t.dataMatch(oldMapLines, newMapLines,
|
|
3028
|
+
var _t$dataMatch5 = t.dataMatch(oldMapLines, newMapLines, "id"),
|
|
3024
3029
|
_deletedDataIDs4 = _t$dataMatch5.deletedDataIDs,
|
|
3025
3030
|
_addedData4 = _t$dataMatch5.addedData,
|
|
3026
3031
|
_updatedData4 = _t$dataMatch5.updatedData;
|
|
@@ -3036,7 +3041,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3036
3041
|
try {
|
|
3037
3042
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
3038
3043
|
var _id3 = _step4.value;
|
|
3039
|
-
t.removeGraphic(_id3,
|
|
3044
|
+
t.removeGraphic(_id3, "line");
|
|
3040
3045
|
}
|
|
3041
3046
|
//增加
|
|
3042
3047
|
} catch (err) {
|
|
@@ -3050,7 +3055,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3050
3055
|
}
|
|
3051
3056
|
//画其他特例线专用
|
|
3052
3057
|
if (customizedBoundary instanceof Array && props.customizedBoundary instanceof Array && !t.deepEqual(customizedBoundary, props.customizedBoundary)) {
|
|
3053
|
-
var _t$dataMatch6 = t.dataMatch(props.customizedBoundary, customizedBoundary,
|
|
3058
|
+
var _t$dataMatch6 = t.dataMatch(props.customizedBoundary, customizedBoundary, "id"),
|
|
3054
3059
|
_deletedDataIDs5 = _t$dataMatch6.deletedDataIDs,
|
|
3055
3060
|
_addedData5 = _t$dataMatch6.addedData,
|
|
3056
3061
|
_updatedData5 = _t$dataMatch6.updatedData;
|
|
@@ -3060,7 +3065,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3060
3065
|
try {
|
|
3061
3066
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3062
3067
|
var _id4 = _step5.value;
|
|
3063
|
-
t.removeGraphic(_id4,
|
|
3068
|
+
t.removeGraphic(_id4, "line");
|
|
3064
3069
|
}
|
|
3065
3070
|
} catch (err) {
|
|
3066
3071
|
_iterator5.e(err);
|
|
@@ -3092,37 +3097,37 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3092
3097
|
t.imageUrlOverlay(imageOverlays);
|
|
3093
3098
|
}
|
|
3094
3099
|
//图元编辑调用
|
|
3095
|
-
if (typeof isDoEdit ==
|
|
3100
|
+
if (typeof isDoEdit == "boolean" && isDoEdit || isDoEdit && isDoEdit !== t.props.isDoEdit) {
|
|
3096
3101
|
t.doEdit(editGraphicId);
|
|
3097
3102
|
}
|
|
3098
3103
|
//是否关闭图元编辑
|
|
3099
|
-
if (typeof isEndEdit ==
|
|
3104
|
+
if (typeof isEndEdit == "boolean" && isEndEdit || isEndEdit && isEndEdit !== t.props.isEndEdit) {
|
|
3100
3105
|
t.endEdit();
|
|
3101
3106
|
}
|
|
3102
3107
|
/*设置指定图元展示*/
|
|
3103
|
-
if (typeof setVisiblePoints ==
|
|
3108
|
+
if (typeof setVisiblePoints == "boolean" && setVisiblePoints || setVisiblePoints && setVisiblePoints !== t.props.setVisiblePoints) {
|
|
3104
3109
|
t.setVisiblePoints(mapVisiblePoints);
|
|
3105
3110
|
}
|
|
3106
3111
|
//绘制图元
|
|
3107
|
-
if (typeof isDraw ==
|
|
3112
|
+
if (typeof isDraw == "boolean" && isDraw || isDraw && isDraw !== t.props.isDraw) {
|
|
3108
3113
|
t.draw(mapDraw);
|
|
3109
3114
|
}
|
|
3110
3115
|
//关闭绘制
|
|
3111
|
-
if (typeof isCloseDraw ==
|
|
3116
|
+
if (typeof isCloseDraw == "boolean" && isCloseDraw || isCloseDraw && isCloseDraw !== t.props.isCloseDraw) {
|
|
3112
3117
|
t.closeDraw();
|
|
3113
3118
|
}
|
|
3114
3119
|
//清空地图
|
|
3115
|
-
if (typeof isClearAll ==
|
|
3120
|
+
if (typeof isClearAll == "boolean" && isClearAll || isClearAll && isClearAll !== t.props.isClearAll) {
|
|
3116
3121
|
t.clearAll();
|
|
3117
3122
|
}
|
|
3118
3123
|
//设置中心点
|
|
3119
|
-
if (typeof setCenter ==
|
|
3124
|
+
if (typeof setCenter == "boolean" && setCenter || setCenter && setCenter !== t.props.setCenter) {
|
|
3120
3125
|
if (!(t.getCurrentCenter().lng == mapCenter[0] && t.getCurrentCenter().lat == mapCenter[1])) {
|
|
3121
3126
|
t.setCenter(mapCenter);
|
|
3122
3127
|
}
|
|
3123
3128
|
}
|
|
3124
3129
|
//设置比例尺
|
|
3125
|
-
if (typeof setZoomLevel ==
|
|
3130
|
+
if (typeof setZoomLevel == "boolean" && setZoomLevel || setZoomLevel && setZoomLevel !== t.props.setZoomLevel) {
|
|
3126
3131
|
if (!(t.getZoomLevel() == mapZoomLevel)) {
|
|
3127
3132
|
t.setZoomLevel(mapZoomLevel);
|
|
3128
3133
|
}
|
|
@@ -3134,7 +3139,7 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3134
3139
|
t.hideTrafficInfo();
|
|
3135
3140
|
}
|
|
3136
3141
|
//设置点聚合
|
|
3137
|
-
if (typeof setCluster ==
|
|
3142
|
+
if (typeof setCluster == "boolean" && setCluster || setCluster && setCluster !== t.props.setCluster) {
|
|
3138
3143
|
t.cluster(mapCluster);
|
|
3139
3144
|
}
|
|
3140
3145
|
// 清除聚合
|
|
@@ -3142,21 +3147,21 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3142
3147
|
t.removeCluster(mapCluster);
|
|
3143
3148
|
}
|
|
3144
3149
|
//测距工具调用
|
|
3145
|
-
if (typeof isRangingTool ==
|
|
3150
|
+
if (typeof isRangingTool == "boolean" && isRangingTool || isRangingTool && isRangingTool !== t.props.isRangingTool) {
|
|
3146
3151
|
t.vtxRangingTool();
|
|
3147
3152
|
}
|
|
3148
3153
|
//单独删除操作
|
|
3149
|
-
if (typeof isRemove ==
|
|
3154
|
+
if (typeof isRemove == "boolean" && isRemove || isRemove && isRemove !== t.props.isRemove) {
|
|
3150
3155
|
mapRemove.map(function (item, index) {
|
|
3151
3156
|
t.removeGraphic(item.id, item.type);
|
|
3152
3157
|
});
|
|
3153
3158
|
}
|
|
3154
3159
|
//设置区域限制
|
|
3155
|
-
if (typeof isSetAreaRestriction ==
|
|
3160
|
+
if (typeof isSetAreaRestriction == "boolean" && isSetAreaRestriction || isSetAreaRestriction && isSetAreaRestriction !== t.props.isSetAreaRestriction && areaRestriction && !!areaRestriction[0] && !!areaRestriction[1]) {
|
|
3156
3161
|
t.setAreaRestriction(areaRestriction);
|
|
3157
3162
|
}
|
|
3158
3163
|
//关闭区域限制
|
|
3159
|
-
if (typeof isClearAreaRestriction ==
|
|
3164
|
+
if (typeof isClearAreaRestriction == "boolean" && isClearAreaRestriction || isClearAreaRestriction && isClearAreaRestriction !== t.props.isClearAreaRestriction) {
|
|
3160
3165
|
t.clearAreaRestriction();
|
|
3161
3166
|
}
|
|
3162
3167
|
|
|
@@ -3174,7 +3179,6 @@ var VortexAMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3174
3179
|
}
|
|
3175
3180
|
}
|
|
3176
3181
|
}]);
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
//# sourceMappingURL=AMap.js.map
|
|
3182
|
+
return VortexAMap;
|
|
3183
|
+
}(_react.default.Component);
|
|
3184
|
+
var _default = exports.default = VortexAMap;
|