@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/OlMap/Map.js
CHANGED
|
@@ -3,53 +3,60 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _default2 =
|
|
8
|
+
var _default2 = _interopRequireWildcard(require("../../default"));
|
|
9
9
|
var _MapToolFunction = require("../MapToolFunction");
|
|
10
10
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
11
|
-
var
|
|
12
|
-
|
|
11
|
+
var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
12
|
+
var _isEmpty = _interopRequireDefault(require("lodash-es/isEmpty"));
|
|
13
|
+
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
18
|
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); }
|
|
14
|
-
function _createForOfIteratorHelper(
|
|
15
|
-
function _toConsumableArray(
|
|
19
|
+
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; } } }; }
|
|
20
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
21
|
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 _iterableToArray(
|
|
18
|
-
function _arrayWithoutHoles(
|
|
19
|
-
function _slicedToArray(
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
function _unsupportedIterableToArray(
|
|
22
|
-
function _arrayLikeToArray(
|
|
23
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t
|
|
24
|
-
function _arrayWithHoles(
|
|
26
|
+
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); }
|
|
27
|
+
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; }
|
|
28
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
30
|
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; }
|
|
26
31
|
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; }
|
|
27
|
-
function _classCallCheck(
|
|
28
|
-
function _defineProperties(
|
|
29
|
-
function _createClass(
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
function
|
|
34
|
-
function
|
|
35
|
-
function
|
|
36
|
-
function
|
|
37
|
-
function _defineProperty(
|
|
38
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
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); } }
|
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
+
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); }
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
+
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); }; }
|
|
38
|
+
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); }
|
|
39
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
40
|
+
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; } }
|
|
41
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
+
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; }
|
|
43
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
39
44
|
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); } //公共地址配置
|
|
40
|
-
var Set = _immutable
|
|
45
|
+
var Set = _immutable.default.Set;
|
|
41
46
|
var defaultMarker = require("../images/defaultMarker.png");
|
|
42
47
|
var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
48
|
+
_inherits(OlMap, _React$Component);
|
|
49
|
+
var _super = _createSuper(OlMap);
|
|
43
50
|
function OlMap(props) {
|
|
44
51
|
var _this;
|
|
45
52
|
_classCallCheck(this, OlMap);
|
|
46
|
-
_this =
|
|
53
|
+
_this = _super.call(this, props);
|
|
47
54
|
// 加载图层
|
|
48
|
-
_defineProperty(_this, "loadLayers", function () {
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "loadLayers", function () {
|
|
49
56
|
var nextLayers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
50
57
|
var currentLayers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
51
58
|
var first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
52
|
-
var t = _this;
|
|
59
|
+
var t = _assertThisInitialized(_this);
|
|
53
60
|
// 对比图层的变化,找出需要新增和需要删除的。
|
|
54
61
|
var addLayers = nextLayers.filter(function (item) {
|
|
55
62
|
return !currentLayers.map(function (e) {
|
|
@@ -71,16 +78,16 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
71
78
|
}
|
|
72
79
|
if (addLayers.length > 0) {
|
|
73
80
|
addLayers.map(function (item) {
|
|
74
|
-
if (item.coverage.startsWith("http") || item.coverage.startsWith(
|
|
81
|
+
if (item.coverage.startsWith("http") || item.coverage.startsWith("/")) {
|
|
75
82
|
switch (item.type) {
|
|
76
83
|
// 超图
|
|
77
|
-
case
|
|
84
|
+
case "superMap":
|
|
78
85
|
t.addSuperMapLayer(item.coverage);
|
|
79
86
|
break;
|
|
80
|
-
case
|
|
87
|
+
case "geoServer":
|
|
81
88
|
t.addGeoServerLayer(item.coverage);
|
|
82
89
|
break;
|
|
83
|
-
case
|
|
90
|
+
case "geoServer_image":
|
|
84
91
|
t.addGeoServerImageLayer(item);
|
|
85
92
|
break;
|
|
86
93
|
default:
|
|
@@ -88,10 +95,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
88
95
|
}
|
|
89
96
|
} else if (item.coverage.indexOf("WMTS") > -1) {
|
|
90
97
|
t.addTileLayer(JSON.parse(item.coverage));
|
|
91
|
-
} else if (item.coverage ==
|
|
98
|
+
} else if (item.coverage == "customLayer") {
|
|
92
99
|
var layers = item.initLayer();
|
|
93
100
|
if (layers) {
|
|
94
|
-
if ((0,
|
|
101
|
+
if ((0, _isArray.default)(layers)) {
|
|
95
102
|
layers.map(function (layer) {
|
|
96
103
|
t.state.gis.addLayer(layer);
|
|
97
104
|
});
|
|
@@ -102,7 +109,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
102
109
|
} else if (OL_SCREEN[item.coverage]) {
|
|
103
110
|
if (first) {
|
|
104
111
|
var _layers = eval(OL_SCREEN[item.coverage].initLayer);
|
|
105
|
-
if ((0,
|
|
112
|
+
if ((0, _isArray.default)(_layers)) {
|
|
106
113
|
_layers.map(function (layer) {
|
|
107
114
|
t.state.gis.addLayer(layer);
|
|
108
115
|
});
|
|
@@ -115,7 +122,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
115
122
|
} else {
|
|
116
123
|
if (first) {
|
|
117
124
|
var layers = eval(OL_SCREEN.tmap_normal.initLayer);
|
|
118
|
-
if ((0,
|
|
125
|
+
if ((0, _isArray.default)(layers)) {
|
|
119
126
|
layers.map(function (layer) {
|
|
120
127
|
t.state.gis.addLayer(layer);
|
|
121
128
|
});
|
|
@@ -126,8 +133,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
126
133
|
}
|
|
127
134
|
});
|
|
128
135
|
_this.zIndexGraphics = []; //需要放在最后的图元,zoom和pan时刷新dom到最后
|
|
129
|
-
_this.htmlPointsId =
|
|
130
|
-
_this.pointCollectionId =
|
|
136
|
+
_this.htmlPointsId = "vtx_gmap_html_points"; //html点位容器id class管理
|
|
137
|
+
_this.pointCollectionId = "vtx_gmap_html_pointCollection"; //海量点canvas点位容器id class管理
|
|
131
138
|
_this.Label = {}; //所有label 集合
|
|
132
139
|
_this.labelLayer = {
|
|
133
140
|
x: 0,
|
|
@@ -144,7 +151,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
144
151
|
_this.drawToolbar = null; //地图绘制对象即interaction
|
|
145
152
|
_this.drawParam = {}; //缓存 绘制的数据
|
|
146
153
|
_this.editToolbar = null; //编辑对象
|
|
147
|
-
_this.editId =
|
|
154
|
+
_this.editId = ""; //当前编辑的图元id
|
|
148
155
|
_this.drawSource = null;
|
|
149
156
|
_this.drawVector = null;
|
|
150
157
|
// 图元绘制保存
|
|
@@ -194,8 +201,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
194
201
|
measureTooltip: null,
|
|
195
202
|
deleteToolTipElement: null,
|
|
196
203
|
deleteToolTip: null,
|
|
197
|
-
continuePolygonMsg:
|
|
198
|
-
continueLineMsg:
|
|
204
|
+
continuePolygonMsg: "点击继续绘制图形",
|
|
205
|
+
continueLineMsg: "点击继续绘制线",
|
|
199
206
|
listener: null,
|
|
200
207
|
drawElements: [],
|
|
201
208
|
drawLayer: null,
|
|
@@ -224,7 +231,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
224
231
|
//地图上面的ids
|
|
225
232
|
circleIds: [],
|
|
226
233
|
//地图上圆的ids
|
|
227
|
-
editGraphic:
|
|
234
|
+
editGraphic: "",
|
|
228
235
|
//当前编辑完后图元所有数据
|
|
229
236
|
boundaryInfo: [],
|
|
230
237
|
//当前画出的边界线的id和区域名
|
|
@@ -244,37 +251,38 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
244
251
|
return _this;
|
|
245
252
|
}
|
|
246
253
|
// 引入ol样式
|
|
247
|
-
|
|
248
|
-
return _createClass(OlMap, [{
|
|
254
|
+
_createClass(OlMap, [{
|
|
249
255
|
key: "loadMapJs",
|
|
250
256
|
value: function loadMapJs() {
|
|
251
257
|
this.loadMapComplete = new Promise(function (resolve, reject) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
258
|
+
(0, _default2.ensurejQuery)().then(function () {
|
|
259
|
+
if (window.OlMap) {
|
|
260
|
+
resolve(window.OlMap);
|
|
261
|
+
} else {
|
|
262
|
+
$.getScript("".concat(_default2.default.openlayerServerURL, "/ol.js"), function () {
|
|
263
|
+
var PointCollection = new Promise(function (resolve, reject) {
|
|
264
|
+
$.getScript("".concat(_default2.default.mapServerURL, "/GPointCollection.js"), function () {
|
|
265
|
+
resolve();
|
|
266
|
+
});
|
|
259
267
|
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
268
|
+
var Client9 = new Promise(function (resolve, reject) {
|
|
269
|
+
$.getScript("".concat(_default2.default.openlayerServerURL, "/iclient-openlayers.min.js"), function () {
|
|
270
|
+
resolve();
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
Promise.all([PointCollection, Client9]).then(function () {
|
|
274
|
+
resolve(window.OlMap);
|
|
264
275
|
});
|
|
265
276
|
});
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
href: "".concat(_default2["default"].openlayerServerURL, "/ol.css")
|
|
276
|
-
}).appendTo('head');
|
|
277
|
-
}
|
|
277
|
+
$.getScript("".concat(_default2.default.openlayerServerURL, "/bd09.js"));
|
|
278
|
+
$.getScript("".concat(_default2.default.openlayerServerURL, "/olScreen.js"));
|
|
279
|
+
$("<link>").attr({
|
|
280
|
+
rel: "stylesheet",
|
|
281
|
+
type: "text/css",
|
|
282
|
+
href: "".concat(_default2.default.openlayerServerURL, "/ol.css")
|
|
283
|
+
}).appendTo("head");
|
|
284
|
+
}
|
|
285
|
+
});
|
|
278
286
|
});
|
|
279
287
|
}
|
|
280
288
|
// 初始化地圖
|
|
@@ -356,29 +364,29 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
356
364
|
var overall_feature = null; //鼠标移入事件时记录当前的feature,为鼠标移出要素时保存操作的要素对象
|
|
357
365
|
var dragAddMoveFlag = false; //记录地图拖拽和移动事件
|
|
358
366
|
// 地图开始加载时
|
|
359
|
-
gis.on(
|
|
367
|
+
gis.on("loadstart", function () {
|
|
360
368
|
if (gis.getTargetElement()) {
|
|
361
|
-
gis.getTargetElement().classList.add(
|
|
369
|
+
gis.getTargetElement().classList.add("spinner");
|
|
362
370
|
}
|
|
363
371
|
});
|
|
364
372
|
// 地图加载结束时
|
|
365
|
-
gis.on(
|
|
373
|
+
gis.on("loadend", function () {
|
|
366
374
|
if (gis.getTargetElement()) {
|
|
367
|
-
gis.getTargetElement().classList.remove(
|
|
375
|
+
gis.getTargetElement().classList.remove("spinner");
|
|
368
376
|
}
|
|
369
377
|
});
|
|
370
378
|
// 地图双击事件
|
|
371
|
-
gis.on(
|
|
379
|
+
gis.on("dbclick", function (evt) {});
|
|
372
380
|
// 地图点击事件
|
|
373
|
-
gis.on(
|
|
381
|
+
gis.on("singleclick", function (evt) {
|
|
374
382
|
var feature = gis.forEachFeatureAtPixel(evt.pixel, function (feature) {
|
|
375
383
|
return feature;
|
|
376
384
|
});
|
|
377
385
|
if (feature) {
|
|
378
386
|
var target = feature.getProperties();
|
|
379
|
-
var id =
|
|
380
|
-
var elementId =
|
|
381
|
-
if ((0,
|
|
387
|
+
var id = "";
|
|
388
|
+
var elementId = "";
|
|
389
|
+
if ((0, _isArray.default)(target.features)) {
|
|
382
390
|
// 处理聚合点击
|
|
383
391
|
var properties = target.features[0].getProperties();
|
|
384
392
|
id = properties.id;
|
|
@@ -396,11 +404,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
396
404
|
}
|
|
397
405
|
});
|
|
398
406
|
// 鼠标移动事件 - 当鼠标指向要素时改变光标状态
|
|
399
|
-
gis.on(
|
|
407
|
+
gis.on("pointermove", function (evt) {
|
|
400
408
|
var pixel = gis.getEventPixel(evt.originalEvent);
|
|
401
409
|
var hit = gis.hasFeatureAtPixel(pixel);
|
|
402
410
|
if (gis.getTargetElement()) {
|
|
403
|
-
gis.getTargetElement().style.cursor = hit ?
|
|
411
|
+
gis.getTargetElement().style.cursor = hit ? "pointer" : "default";
|
|
404
412
|
}
|
|
405
413
|
// 获取到当前鼠标移动下的feature
|
|
406
414
|
var feature = gis.forEachFeatureAtPixel(pixel, function (feature, layer) {
|
|
@@ -413,7 +421,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
413
421
|
} else {
|
|
414
422
|
if (overall_feature) {
|
|
415
423
|
overall_feature.dispatchEvent({
|
|
416
|
-
type:
|
|
424
|
+
type: "mousein",
|
|
417
425
|
event: evt
|
|
418
426
|
});
|
|
419
427
|
var _values = overall_feature.getProperties();
|
|
@@ -423,14 +431,14 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
423
431
|
}
|
|
424
432
|
});
|
|
425
433
|
// 鼠标拖拽事件 - 拖拽开始即是地图移动开始
|
|
426
|
-
gis.on(
|
|
434
|
+
gis.on("pointerdrag", function (evt) {
|
|
427
435
|
dragAddMoveFlag = true;
|
|
428
436
|
t.dragMapStart(evt);
|
|
429
437
|
t.moveStart(evt);
|
|
430
438
|
});
|
|
431
439
|
var zoom = 0;
|
|
432
440
|
// 地图移动事件 - 移动结束即是拖拽事件结束 也是地图缩放事件(无开始和结束事件)的监听
|
|
433
|
-
gis.on(
|
|
441
|
+
gis.on("moveend", function (evt) {
|
|
434
442
|
t.dragMapEnd(evt);
|
|
435
443
|
t.moveEnd(evt);
|
|
436
444
|
t.zoomStart(evt);
|
|
@@ -475,7 +483,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
475
483
|
maxZoom = 19;
|
|
476
484
|
}
|
|
477
485
|
if (!projection) {
|
|
478
|
-
projection =
|
|
486
|
+
projection = "EPSG:4326";
|
|
479
487
|
}
|
|
480
488
|
//中心点
|
|
481
489
|
var center = mapCenter && mapCenter instanceof Array && mapCenter.length == 2 ? mapCenter : [116.400433, 39.906705];
|
|
@@ -516,7 +524,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
516
524
|
sourceOptions = options.sourceOptions;
|
|
517
525
|
|
|
518
526
|
//切片名
|
|
519
|
-
var matrixIds = [
|
|
527
|
+
var matrixIds = ["EPSG:4326:0", "EPSG:4326:1", "EPSG:4326:2", "EPSG:4326:3", "EPSG:4326:4", "EPSG:4326:5", "EPSG:4326:6", "EPSG:4326:7", "EPSG:4326:8", "EPSG:4326:9", "EPSG:4326:10", "EPSG:4326:11", "EPSG:4326:12", "EPSG:4326:13", "EPSG:4326:14", "EPSG:4326:15", "EPSG:4326:16", "EPSG:4326:17", "EPSG:4326:18"];
|
|
520
528
|
|
|
521
529
|
//分辨率
|
|
522
530
|
var resolutions = [0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 6.866455078125e-4, 3.4332275390625e-4, 1.71661376953125e-4, 8.58306884765625e-5, 4.291534423828125e-5, 2.1457672119140625e-5, 1.0728836059570312e-5, 5.364418029785156e-6, 2.682209014892578e-6];
|
|
@@ -535,15 +543,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
535
543
|
|
|
536
544
|
//设置地图投影
|
|
537
545
|
var projection = new ol.proj.Projection({
|
|
538
|
-
code:
|
|
539
|
-
units:
|
|
540
|
-
axisOrientation:
|
|
546
|
+
code: "EPSG:4326",
|
|
547
|
+
units: "degrees",
|
|
548
|
+
axisOrientation: "neu"
|
|
541
549
|
});
|
|
542
550
|
return new ol.source.WMTS(_objectSpread({
|
|
543
551
|
url: url,
|
|
544
552
|
layer: params === null || params === void 0 ? void 0 : params.layer,
|
|
545
|
-
format:
|
|
546
|
-
matrixSet:
|
|
553
|
+
format: "image/png",
|
|
554
|
+
matrixSet: "EPSG:4326",
|
|
547
555
|
projection: projection,
|
|
548
556
|
tileGrid: tilegrid
|
|
549
557
|
}, sourceOptions));
|
|
@@ -568,7 +576,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
568
576
|
exist.layer.setVisible(true);
|
|
569
577
|
return;
|
|
570
578
|
}
|
|
571
|
-
var layerSource = source || (type ===
|
|
579
|
+
var layerSource = source || (type === "WMTS" ? this.getWMTS({
|
|
572
580
|
url: url,
|
|
573
581
|
params: params,
|
|
574
582
|
sourceOptions: sourceOptions
|
|
@@ -628,7 +636,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
628
636
|
format: new ol.format.GeoJSON(),
|
|
629
637
|
// url(extent) 在地图范围变化时调用,返回当前的地图范围
|
|
630
638
|
url: function url(extent) {
|
|
631
|
-
return "".concat(_url, "&bbox=").concat(extent.join(
|
|
639
|
+
return "".concat(_url, "&bbox=").concat(extent.join(","));
|
|
632
640
|
},
|
|
633
641
|
strategy: ol.loadingstrategy.bbox
|
|
634
642
|
});
|
|
@@ -641,7 +649,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
641
649
|
style: function style(feature) {
|
|
642
650
|
var _icon$;
|
|
643
651
|
var el = feature.A || {};
|
|
644
|
-
var icon = JSON.parse(el.icon ||
|
|
652
|
+
var icon = JSON.parse(el.icon || "[]");
|
|
645
653
|
var mapIcon = (_icon$ = icon[0]) !== null && _icon$ !== void 0 && _icon$.id ? "/cloudFile/common/downloadFile?id=".concat(icon[0].id) : require("../images/defaultMarker.png");
|
|
646
654
|
return new ol.style.Style({
|
|
647
655
|
// 点位图标
|
|
@@ -651,12 +659,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
651
659
|
}),
|
|
652
660
|
// 线样式
|
|
653
661
|
stroke: new ol.style.Stroke({
|
|
654
|
-
color: el.color ||
|
|
662
|
+
color: el.color || "#1890ff",
|
|
655
663
|
width: 4
|
|
656
664
|
}),
|
|
657
665
|
// 面样式
|
|
658
666
|
fill: new ol.style.Fill({
|
|
659
|
-
color: el.color ||
|
|
667
|
+
color: el.color || "rgba(255,255,255, 0.5)"
|
|
660
668
|
})
|
|
661
669
|
});
|
|
662
670
|
}
|
|
@@ -675,7 +683,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
675
683
|
address = url.split("?")[0];
|
|
676
684
|
url.split("?")[1].split("&").map(function (item) {
|
|
677
685
|
var json = item.split("=");
|
|
678
|
-
param[json[0].toUpperCase()] = json[1] ? decodeURIComponent(json[1]) :
|
|
686
|
+
param[json[0].toUpperCase()] = json[1] ? decodeURIComponent(json[1]) : "";
|
|
679
687
|
});
|
|
680
688
|
return {
|
|
681
689
|
param: param,
|
|
@@ -701,11 +709,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
701
709
|
// 矢量数据源
|
|
702
710
|
var vectorSource = new ol.source.ImageWMS({
|
|
703
711
|
url: address,
|
|
704
|
-
serverType:
|
|
705
|
-
crossOrigin:
|
|
712
|
+
serverType: "geoserver",
|
|
713
|
+
crossOrigin: "*",
|
|
706
714
|
ratio: 1,
|
|
707
715
|
params: _objectSpread(_objectSpread({
|
|
708
|
-
VERSION:
|
|
716
|
+
VERSION: "1.1.0"
|
|
709
717
|
}, item.param || {}), param)
|
|
710
718
|
});
|
|
711
719
|
|
|
@@ -835,7 +843,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
835
843
|
} else {
|
|
836
844
|
t.state.gis.addInteraction(t.editToolbar);
|
|
837
845
|
}
|
|
838
|
-
t.editToolbar.on(
|
|
846
|
+
t.editToolbar.on("modifyend", function (e) {
|
|
839
847
|
var feature = gc;
|
|
840
848
|
e.features.forEach(function (feature) {
|
|
841
849
|
feature = feature;
|
|
@@ -846,7 +854,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
846
854
|
e: e
|
|
847
855
|
};
|
|
848
856
|
// 绘制内部管理的图元
|
|
849
|
-
if (gp.geometry.type ==
|
|
857
|
+
if (gp.geometry.type == "point") {
|
|
850
858
|
var cur = feature.getProperties().geometry;
|
|
851
859
|
var _cur$flatCoordinates = _slicedToArray(cur.flatCoordinates, 2),
|
|
852
860
|
lng = _cur$flatCoordinates[0],
|
|
@@ -875,14 +883,14 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
875
883
|
},
|
|
876
884
|
geometryType: gp.geometry.type,
|
|
877
885
|
geometry: {
|
|
878
|
-
type:
|
|
886
|
+
type: "point",
|
|
879
887
|
x: lng,
|
|
880
888
|
y: lat
|
|
881
889
|
}
|
|
882
890
|
});
|
|
883
891
|
}
|
|
884
892
|
//线
|
|
885
|
-
if (gp.geometry.type ==
|
|
893
|
+
if (gp.geometry.type == "polyline") {
|
|
886
894
|
var _cur = feature.getProperties().geometry;
|
|
887
895
|
var oddList = [],
|
|
888
896
|
evenList = [];
|
|
@@ -920,7 +928,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
920
928
|
_extent: _extent,
|
|
921
929
|
type: "polyline"
|
|
922
930
|
},
|
|
923
|
-
geometryType:
|
|
931
|
+
geometryType: "polyline",
|
|
924
932
|
lnglatAry: lnglatAry,
|
|
925
933
|
mapLayer: t.GM.getGraphic(id)
|
|
926
934
|
},
|
|
@@ -934,7 +942,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
934
942
|
});
|
|
935
943
|
}
|
|
936
944
|
//面
|
|
937
|
-
if (gp.geometry.type ==
|
|
945
|
+
if (gp.geometry.type == "polygon") {
|
|
938
946
|
var _cur2 = feature.getProperties().geometry;
|
|
939
947
|
var _oddList = [],
|
|
940
948
|
_evenList = [];
|
|
@@ -969,23 +977,23 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
969
977
|
}),
|
|
970
978
|
geometry: {
|
|
971
979
|
rings: _path,
|
|
972
|
-
type:
|
|
980
|
+
type: "polygon",
|
|
973
981
|
_extent: _extent2
|
|
974
982
|
},
|
|
975
|
-
geometryType:
|
|
983
|
+
geometryType: "polygon",
|
|
976
984
|
lnglatAry: _lnglatAry,
|
|
977
985
|
mapLayer: t.GM.getGraphic(id)
|
|
978
986
|
},
|
|
979
987
|
geometryType: gp.geometry.type,
|
|
980
988
|
geometry: {
|
|
981
989
|
rings: _path,
|
|
982
|
-
type:
|
|
990
|
+
type: "polygon",
|
|
983
991
|
_extent: _extent2
|
|
984
992
|
},
|
|
985
993
|
area: (0, _MapToolFunction.getPolygonArea)(_path)
|
|
986
994
|
});
|
|
987
995
|
}
|
|
988
|
-
if (gp.geometry.type ==
|
|
996
|
+
if (gp.geometry.type == "circle") {
|
|
989
997
|
var _cur3 = feature.getProperties().geometry;
|
|
990
998
|
var center = _cur3.getCenter();
|
|
991
999
|
var sketchCoords_ = [_cur3.flatCoordinates[0], _cur3.flatCoordinates[1]];
|
|
@@ -1017,22 +1025,22 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1017
1025
|
x: center[0],
|
|
1018
1026
|
y: center[1],
|
|
1019
1027
|
radius: radius,
|
|
1020
|
-
type:
|
|
1028
|
+
type: "circle"
|
|
1021
1029
|
},
|
|
1022
|
-
geometryType:
|
|
1030
|
+
geometryType: "circle",
|
|
1023
1031
|
mapLayer: t.GM.getGraphic(id)
|
|
1024
1032
|
},
|
|
1025
1033
|
geometryType: gp.geometry.type,
|
|
1026
1034
|
area: Math.PI * Math.pow(radius, 2),
|
|
1027
1035
|
geometry: {
|
|
1028
|
-
type:
|
|
1036
|
+
type: "circle",
|
|
1029
1037
|
x: center[0],
|
|
1030
1038
|
y: center[1],
|
|
1031
1039
|
radius: radius
|
|
1032
1040
|
}
|
|
1033
1041
|
});
|
|
1034
1042
|
}
|
|
1035
|
-
if (
|
|
1043
|
+
if ("editGraphicChange" in t.props && typeof t.props.editGraphicChange == "function") {
|
|
1036
1044
|
t.props.editGraphicChange(param);
|
|
1037
1045
|
}
|
|
1038
1046
|
t.GM.setGraphic(id, feature).setGraphicParam(id, _objectSpread(_objectSpread({}, param), {}, {
|
|
@@ -1050,7 +1058,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1050
1058
|
t.state.gis.removeInteraction(t.editToolbar);
|
|
1051
1059
|
t.editToolbar = null;
|
|
1052
1060
|
}
|
|
1053
|
-
t.editId =
|
|
1061
|
+
t.editId = "";
|
|
1054
1062
|
}
|
|
1055
1063
|
// 绘制图元
|
|
1056
1064
|
}, {
|
|
@@ -1064,7 +1072,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1064
1072
|
stroke,
|
|
1065
1073
|
fill;
|
|
1066
1074
|
//初始化参数
|
|
1067
|
-
drawParam.geometryType = obj.geometryType ||
|
|
1075
|
+
drawParam.geometryType = obj.geometryType || "point";
|
|
1068
1076
|
drawParam.parameter = obj.parameter ? _objectSpread({}, obj.parameter) : {};
|
|
1069
1077
|
drawParam.data = obj.data ? _objectSpread({}, obj.data) : {};
|
|
1070
1078
|
drawParam.data.id = (obj.data || {}).id || "draw".concat(new Date().getTime());
|
|
@@ -1077,12 +1085,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1077
1085
|
t.removeGraphic(drawParam.data.id);
|
|
1078
1086
|
t.state.drawIds[drawParam.geometryType].splice(len, 1);
|
|
1079
1087
|
}
|
|
1080
|
-
var type =
|
|
1088
|
+
var type = "Point",
|
|
1081
1089
|
style = new ol.style.Style({
|
|
1082
1090
|
image: new ol.style.Icon({
|
|
1083
1091
|
anchor: [-drawParam.parameter.markerContentX || -15, -drawParam.parameter.markerContentY || -15],
|
|
1084
|
-
anchorXUnits:
|
|
1085
|
-
anchorYUnits:
|
|
1092
|
+
anchorXUnits: "pixels",
|
|
1093
|
+
anchorYUnits: "pixels",
|
|
1086
1094
|
src: drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1087
1095
|
opacity: 1,
|
|
1088
1096
|
scale: drawParam.parameter.scale || 1
|
|
@@ -1090,56 +1098,56 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1090
1098
|
});
|
|
1091
1099
|
var geometryFunction;
|
|
1092
1100
|
switch (drawParam.geometryType) {
|
|
1093
|
-
case
|
|
1094
|
-
type =
|
|
1101
|
+
case "point":
|
|
1102
|
+
type = "Point";
|
|
1095
1103
|
style = new ol.style.Style({
|
|
1096
1104
|
image: new ol.style.Icon({
|
|
1097
1105
|
anchor: [-drawParam.parameter.markerContentX || -15, -drawParam.parameter.markerContentY || -15],
|
|
1098
|
-
anchorXUnits:
|
|
1099
|
-
anchorYUnits:
|
|
1106
|
+
anchorXUnits: "pixels",
|
|
1107
|
+
anchorYUnits: "pixels",
|
|
1100
1108
|
src: drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1101
1109
|
opacity: 1,
|
|
1102
1110
|
scale: drawParam.parameter.scale || 1
|
|
1103
1111
|
})
|
|
1104
1112
|
});
|
|
1105
1113
|
break;
|
|
1106
|
-
case
|
|
1107
|
-
type =
|
|
1114
|
+
case "polyline":
|
|
1115
|
+
type = "LineString";
|
|
1108
1116
|
style = new ol.style.Style({
|
|
1109
1117
|
stoke: new ol.style.Stroke({
|
|
1110
|
-
color: drawParam.parameter.color ||
|
|
1118
|
+
color: drawParam.parameter.color || "#277ffa",
|
|
1111
1119
|
width: drawParam.parameter.lineWidth || 3,
|
|
1112
|
-
lineDash: drawParam.parameter.lineType ==
|
|
1120
|
+
lineDash: drawParam.parameter.lineType == "dashed" ? [2] : undefined
|
|
1113
1121
|
})
|
|
1114
1122
|
});
|
|
1115
1123
|
break;
|
|
1116
|
-
case
|
|
1117
|
-
type =
|
|
1124
|
+
case "polygon":
|
|
1125
|
+
type = "Polygon";
|
|
1118
1126
|
style = new ol.style.Style({
|
|
1119
1127
|
stoke: new ol.style.Stroke({
|
|
1120
|
-
color: drawParam.parameter.color ||
|
|
1128
|
+
color: drawParam.parameter.color || "#277ffa",
|
|
1121
1129
|
width: drawParam.parameter.lineWidth || 3,
|
|
1122
|
-
lineDash: drawParam.parameter.lineType ==
|
|
1130
|
+
lineDash: drawParam.parameter.lineType == "dashed" ? [2] : undefined
|
|
1123
1131
|
}),
|
|
1124
1132
|
fill: new ol.style.Fill({
|
|
1125
|
-
color: drawParam.parameter.pellucidity ? getRgbColor(drawParam.parameter.color ||
|
|
1133
|
+
color: drawParam.parameter.pellucidity ? getRgbColor(drawParam.parameter.color || "#277ffa", drawParam.parameter.pellucidity) : drawParam.parameter.color || "#277ffa"
|
|
1126
1134
|
})
|
|
1127
1135
|
});
|
|
1128
1136
|
break;
|
|
1129
|
-
case
|
|
1130
|
-
type =
|
|
1137
|
+
case "rectangle":
|
|
1138
|
+
type = "Circle";
|
|
1131
1139
|
geometryFunction = ol.interaction.Draw.createBox();
|
|
1132
1140
|
break;
|
|
1133
|
-
case
|
|
1134
|
-
type =
|
|
1141
|
+
case "circle":
|
|
1142
|
+
type = "Circle";
|
|
1135
1143
|
style = new ol.style.Style({
|
|
1136
1144
|
stoke: new ol.style.Stroke({
|
|
1137
|
-
color: drawParam.parameter.color ||
|
|
1145
|
+
color: drawParam.parameter.color || "#277ffa",
|
|
1138
1146
|
width: drawParam.parameter.lineWidth || 3,
|
|
1139
|
-
lineDash: drawParam.parameter.lineType ==
|
|
1147
|
+
lineDash: drawParam.parameter.lineType == "dashed" ? [2] : undefined
|
|
1140
1148
|
}),
|
|
1141
1149
|
fill: new ol.style.Fill({
|
|
1142
|
-
color: drawParam.parameter.pellucidity ? getRgbColor(drawParam.parameter.color ||
|
|
1150
|
+
color: drawParam.parameter.pellucidity ? getRgbColor(drawParam.parameter.color || "#277ffa", drawParam.parameter.pellucidity) : drawParam.parameter.color || "#277ffa"
|
|
1143
1151
|
})
|
|
1144
1152
|
});
|
|
1145
1153
|
break;
|
|
@@ -1155,7 +1163,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1155
1163
|
} else {
|
|
1156
1164
|
gis.addInteraction(t.drawToolbar);
|
|
1157
1165
|
}
|
|
1158
|
-
t.drawToolbar.on(
|
|
1166
|
+
t.drawToolbar.on("drawend", function (e) {
|
|
1159
1167
|
var _t$frameSelectProps$p;
|
|
1160
1168
|
// 关闭绘制事件
|
|
1161
1169
|
t.drawToolbar.finishDrawing();
|
|
@@ -1165,7 +1173,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1165
1173
|
//返回参数
|
|
1166
1174
|
var param = {};
|
|
1167
1175
|
// 绘制内部管理的图元
|
|
1168
|
-
if (t.drawParam.geometryType ==
|
|
1176
|
+
if (t.drawParam.geometryType == "point") {
|
|
1169
1177
|
var _gc$flatCoordinates = _slicedToArray(gc.flatCoordinates, 2),
|
|
1170
1178
|
lng = _gc$flatCoordinates[0],
|
|
1171
1179
|
lat = _gc$flatCoordinates[1];
|
|
@@ -1186,7 +1194,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1186
1194
|
latitude: lat,
|
|
1187
1195
|
url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1188
1196
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1189
|
-
}],
|
|
1197
|
+
}], "point");
|
|
1190
1198
|
}
|
|
1191
1199
|
|
|
1192
1200
|
//处理点返回参数
|
|
@@ -1201,12 +1209,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1201
1209
|
}
|
|
1202
1210
|
},
|
|
1203
1211
|
geometry: gc,
|
|
1204
|
-
geometryType:
|
|
1212
|
+
geometryType: "point",
|
|
1205
1213
|
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1206
1214
|
};
|
|
1207
1215
|
}
|
|
1208
1216
|
//线
|
|
1209
|
-
if (t.drawParam.geometryType ==
|
|
1217
|
+
if (t.drawParam.geometryType == "polyline") {
|
|
1210
1218
|
var oddList = [],
|
|
1211
1219
|
evenList = [];
|
|
1212
1220
|
gc.flatCoordinates.map(function (item, index) {
|
|
@@ -1225,13 +1233,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1225
1233
|
id: t.drawParam.data.id,
|
|
1226
1234
|
paths: path,
|
|
1227
1235
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1228
|
-
}],
|
|
1236
|
+
}], "polyline");
|
|
1229
1237
|
} else {
|
|
1230
1238
|
t.addLine([{
|
|
1231
1239
|
id: t.drawParam.data.id,
|
|
1232
1240
|
paths: path,
|
|
1233
1241
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1234
|
-
}],
|
|
1242
|
+
}], "polyline");
|
|
1235
1243
|
}
|
|
1236
1244
|
//处理线返回参数
|
|
1237
1245
|
var _t$dealData3 = t.dealData(path),
|
|
@@ -1249,12 +1257,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1249
1257
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1250
1258
|
},
|
|
1251
1259
|
distance: t.calculateDistance(path),
|
|
1252
|
-
geometryType:
|
|
1260
|
+
geometryType: "polyline",
|
|
1253
1261
|
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1254
1262
|
};
|
|
1255
1263
|
}
|
|
1256
1264
|
//面
|
|
1257
|
-
if (t.drawParam.geometryType ==
|
|
1265
|
+
if (t.drawParam.geometryType == "polygon") {
|
|
1258
1266
|
var _oddList2 = [],
|
|
1259
1267
|
_evenList2 = [];
|
|
1260
1268
|
gc.flatCoordinates.map(function (item, index) {
|
|
@@ -1302,7 +1310,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1302
1310
|
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1303
1311
|
};
|
|
1304
1312
|
}
|
|
1305
|
-
if (t.drawParam.geometryType ==
|
|
1313
|
+
if (t.drawParam.geometryType == "rectangle") {
|
|
1306
1314
|
var _path3 = e.feature.getGeometry().getCoordinates()[0];
|
|
1307
1315
|
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1308
1316
|
t.updatePolygon([{
|
|
@@ -1338,7 +1346,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1338
1346
|
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1339
1347
|
};
|
|
1340
1348
|
}
|
|
1341
|
-
if (t.drawParam.geometryType ==
|
|
1349
|
+
if (t.drawParam.geometryType == "circle") {
|
|
1342
1350
|
var center = e.feature.getGeometry().getCenter();
|
|
1343
1351
|
var cur = e.feature.getProperties().geometry;
|
|
1344
1352
|
var sketchCoords_ = [cur.flatCoordinates[0], cur.flatCoordinates[1]];
|
|
@@ -1377,7 +1385,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1377
1385
|
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1378
1386
|
};
|
|
1379
1387
|
}
|
|
1380
|
-
if (
|
|
1388
|
+
if ("drawEnd" in t.props && typeof t.props.drawEnd == "function") {
|
|
1381
1389
|
t.props.drawEnd(param);
|
|
1382
1390
|
}
|
|
1383
1391
|
if (((_t$frameSelectProps$p = t.frameSelectProps[param.attributes.id]) === null || _t$frameSelectProps$p === void 0 ? void 0 : _t$frameSelectProps$p.callback) instanceof Function) {
|
|
@@ -1415,39 +1423,39 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1415
1423
|
source: source,
|
|
1416
1424
|
style: new ol.style.Style({
|
|
1417
1425
|
fill: new ol.style.Fill({
|
|
1418
|
-
color:
|
|
1426
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1419
1427
|
}),
|
|
1420
1428
|
stroke: new ol.style.Stroke({
|
|
1421
|
-
color:
|
|
1429
|
+
color: "#ffcc33",
|
|
1422
1430
|
width: 4
|
|
1423
1431
|
}),
|
|
1424
1432
|
image: new ol.style.Circle({
|
|
1425
1433
|
radius: 7,
|
|
1426
1434
|
fill: new ol.style.Fill({
|
|
1427
|
-
color:
|
|
1435
|
+
color: "#ffcc33"
|
|
1428
1436
|
})
|
|
1429
1437
|
})
|
|
1430
1438
|
})
|
|
1431
1439
|
});
|
|
1432
1440
|
t.rangingInfo.draw = new ol.interaction.Draw({
|
|
1433
1441
|
source: source,
|
|
1434
|
-
type:
|
|
1442
|
+
type: "LineString",
|
|
1435
1443
|
style: new ol.style.Style({
|
|
1436
1444
|
fill: new ol.style.Fill({
|
|
1437
|
-
color:
|
|
1445
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1438
1446
|
}),
|
|
1439
1447
|
stroke: new ol.style.Stroke({
|
|
1440
|
-
color:
|
|
1448
|
+
color: "rgba(0, 0, 0, 0.5)",
|
|
1441
1449
|
lineDash: [10, 10],
|
|
1442
1450
|
width: 4
|
|
1443
1451
|
}),
|
|
1444
1452
|
image: new ol.style.Circle({
|
|
1445
1453
|
radius: 5,
|
|
1446
1454
|
stroke: new ol.style.Stroke({
|
|
1447
|
-
color:
|
|
1455
|
+
color: "rgba(0, 0, 0, 0.7)"
|
|
1448
1456
|
}),
|
|
1449
1457
|
fill: new ol.style.Fill({
|
|
1450
|
-
color:
|
|
1458
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1451
1459
|
})
|
|
1452
1460
|
})
|
|
1453
1461
|
})
|
|
@@ -1459,10 +1467,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1459
1467
|
t.state.gis.addLayer(t.rangingInfo.drawLayer);
|
|
1460
1468
|
t.state.gis.addInteraction(t.rangingInfo.draw);
|
|
1461
1469
|
// 开始监听绘制
|
|
1462
|
-
t.rangingInfo.draw.on(
|
|
1470
|
+
t.rangingInfo.draw.on("drawstart", function (evt) {
|
|
1463
1471
|
t.rangingInfo.feature = evt.feature;
|
|
1464
1472
|
var tooltipCoord = evt.coordinate;
|
|
1465
|
-
t.rangingInfo.listener = evt.feature.getGeometry().on(
|
|
1473
|
+
t.rangingInfo.listener = evt.feature.getGeometry().on("change", function (evt) {
|
|
1466
1474
|
var geom = evt.target;
|
|
1467
1475
|
var flatCoordinates = geom.flatCoordinates;
|
|
1468
1476
|
var lngLats = [[flatCoordinates[0], flatCoordinates[1]], [flatCoordinates[2], flatCoordinates[3]]];
|
|
@@ -1479,15 +1487,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1479
1487
|
});
|
|
1480
1488
|
});
|
|
1481
1489
|
// 双击绘制完成
|
|
1482
|
-
t.rangingInfo.draw.on(
|
|
1483
|
-
t.rangingInfo.measureTooltipElement.className =
|
|
1490
|
+
t.rangingInfo.draw.on("drawend", function () {
|
|
1491
|
+
t.rangingInfo.measureTooltipElement.className = "ol-tooltip ol-tooltip-static";
|
|
1484
1492
|
t.rangingInfo.measureTooltip.setOffset([0, -7]);
|
|
1485
1493
|
t.rangingInfo.feature = null;
|
|
1486
1494
|
t.rangingInfo.measureTooltipElement = null;
|
|
1487
1495
|
// t.createMeasureTooltip();
|
|
1488
1496
|
new ol.Observable.unByKey(t.rangingInfo.listener);
|
|
1489
1497
|
t.state.gis.removeInteraction(t.rangingInfo.draw);
|
|
1490
|
-
if (
|
|
1498
|
+
if ("mapRangingTool" in t.props) {
|
|
1491
1499
|
t.props.mapRangingTool(obj);
|
|
1492
1500
|
}
|
|
1493
1501
|
});
|
|
@@ -1500,12 +1508,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1500
1508
|
if (t.rangingTool.helpTooltipElement) {
|
|
1501
1509
|
t.rangingTool.helpTooltipElement.parentNode.removeChild(t.rangingTool.helpTooltipElement);
|
|
1502
1510
|
}
|
|
1503
|
-
t.rangingTool.helpTooltipElement = document.createElement(
|
|
1504
|
-
t.rangingTool.helpTooltipElement.className =
|
|
1511
|
+
t.rangingTool.helpTooltipElement = document.createElement("div");
|
|
1512
|
+
t.rangingTool.helpTooltipElement.className = "ol-tooltip hidden";
|
|
1505
1513
|
t.rangingTool.helpTooltip = new ol.Overlay({
|
|
1506
1514
|
element: t.rangingTool.helpTooltipElement,
|
|
1507
1515
|
offset: [15, 0],
|
|
1508
|
-
positioning:
|
|
1516
|
+
positioning: "center-left"
|
|
1509
1517
|
});
|
|
1510
1518
|
t.state.gis.addOverlay(t.rangingTool.helpTooltip);
|
|
1511
1519
|
}
|
|
@@ -1517,12 +1525,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1517
1525
|
if (t.rangingInfo.measureTooltipElement) {
|
|
1518
1526
|
t.rangingInfo.measureTooltipElement.parentNode.removeChild(t.rangingInfo.measureTooltipElement);
|
|
1519
1527
|
}
|
|
1520
|
-
t.rangingInfo.measureTooltipElement = document.createElement(
|
|
1521
|
-
t.rangingInfo.measureTooltipElement.className =
|
|
1528
|
+
t.rangingInfo.measureTooltipElement = document.createElement("div");
|
|
1529
|
+
t.rangingInfo.measureTooltipElement.className = "ol-tooltip ol-tooltip-measure";
|
|
1522
1530
|
t.rangingInfo.measureTooltip = new ol.Overlay({
|
|
1523
1531
|
element: t.rangingInfo.measureTooltipElement,
|
|
1524
1532
|
offset: [0, -15],
|
|
1525
|
-
positioning:
|
|
1533
|
+
positioning: "bottom-center",
|
|
1526
1534
|
stopEvent: false,
|
|
1527
1535
|
insertFirst: false
|
|
1528
1536
|
});
|
|
@@ -1536,10 +1544,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1536
1544
|
if (t.rangingInfo.deleteToolTipElement) {
|
|
1537
1545
|
t.rangingInfo.deleteToolTipElement.parentNode.removeChild(t.rangingInfo.deleteToolTipElement);
|
|
1538
1546
|
}
|
|
1539
|
-
t.rangingInfo.deleteToolTipElement = document.createElement(
|
|
1540
|
-
t.rangingInfo.deleteToolTipElement.className =
|
|
1541
|
-
t.rangingInfo.deleteToolTipElement.innerHTML =
|
|
1542
|
-
t.rangingInfo.deleteToolTipElement.addEventListener(
|
|
1547
|
+
t.rangingInfo.deleteToolTipElement = document.createElement("div");
|
|
1548
|
+
t.rangingInfo.deleteToolTipElement.className = "ol-tooltip-delete";
|
|
1549
|
+
t.rangingInfo.deleteToolTipElement.innerHTML = "X";
|
|
1550
|
+
t.rangingInfo.deleteToolTipElement.addEventListener("click", function (e) {
|
|
1543
1551
|
t.rangingInfo.measureTooltipElement = null;
|
|
1544
1552
|
t.rangingInfo.helpTooltipElement = null;
|
|
1545
1553
|
t.rangingInfo.deleteToolTipElement = null;
|
|
@@ -1553,7 +1561,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1553
1561
|
t.rangingInfo.deleteToolTip = new ol.Overlay({
|
|
1554
1562
|
element: t.rangingInfo.deleteToolTipElement,
|
|
1555
1563
|
offset: [15, 15],
|
|
1556
|
-
positioning:
|
|
1564
|
+
positioning: "bottom-center",
|
|
1557
1565
|
stopEvent: false,
|
|
1558
1566
|
insertFirst: true
|
|
1559
1567
|
});
|
|
@@ -1574,19 +1582,18 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1574
1582
|
length += ol.sphere.getDistance(paths[index], paths[index + 1]);
|
|
1575
1583
|
}
|
|
1576
1584
|
});
|
|
1577
|
-
var output =
|
|
1585
|
+
var output = "";
|
|
1578
1586
|
if (length > 100) {
|
|
1579
|
-
output = Math.round(length / 1000 * 100) / 100 +
|
|
1587
|
+
output = Math.round(length / 1000 * 100) / 100 + " " + "km";
|
|
1580
1588
|
} else {
|
|
1581
|
-
output = Math.round(length * 100) / 100 +
|
|
1589
|
+
output = Math.round(length * 100) / 100 + " " + "m";
|
|
1582
1590
|
}
|
|
1583
1591
|
return output;
|
|
1584
1592
|
}
|
|
1593
|
+
// 获取地图的当前位置状态信息
|
|
1585
1594
|
}, {
|
|
1586
1595
|
key: "getMapExtent",
|
|
1587
|
-
value:
|
|
1588
|
-
// 获取地图的当前位置状态信息
|
|
1589
|
-
function getMapExtent() {
|
|
1596
|
+
value: function getMapExtent() {
|
|
1590
1597
|
var t = this;
|
|
1591
1598
|
var gis = t.state.gis;
|
|
1592
1599
|
var obj = {};
|
|
@@ -1615,11 +1622,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1615
1622
|
}
|
|
1616
1623
|
}
|
|
1617
1624
|
//将制定图元展示在视野内 (强制改变地图中心位置)
|
|
1618
|
-
/*
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1625
|
+
/*
|
|
1626
|
+
参数arg格式如下1,2
|
|
1627
|
+
1.string 格式如:'1,a,2,3,4'
|
|
1628
|
+
2.数组 ['1','2']
|
|
1629
|
+
*/
|
|
1623
1630
|
}, {
|
|
1624
1631
|
key: "setVisiblePoints",
|
|
1625
1632
|
value: function setVisiblePoints(mapVisiblePoints) {
|
|
@@ -1630,27 +1637,27 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1630
1637
|
var ary = []; //图元id集合
|
|
1631
1638
|
var obj = []; //经纬度集合
|
|
1632
1639
|
switch (mapVisiblePoints.fitView) {
|
|
1633
|
-
case
|
|
1640
|
+
case "point":
|
|
1634
1641
|
arg = this.state.pointIds;
|
|
1635
1642
|
break;
|
|
1636
|
-
case
|
|
1643
|
+
case "line":
|
|
1637
1644
|
arg = this.state.lineIds;
|
|
1638
1645
|
break;
|
|
1639
|
-
case
|
|
1646
|
+
case "polygon":
|
|
1640
1647
|
arg = this.state.polygonIds;
|
|
1641
1648
|
break;
|
|
1642
|
-
case
|
|
1649
|
+
case "circle":
|
|
1643
1650
|
arg = this.state.circleIds;
|
|
1644
1651
|
break;
|
|
1645
|
-
case
|
|
1652
|
+
case "all":
|
|
1646
1653
|
arg = this.state.pointIds.concat(this.state.lineIds).concat(this.state.polygonIds).concat(this.state.circleIds);
|
|
1647
1654
|
break;
|
|
1648
1655
|
default:
|
|
1649
1656
|
arg = mapVisiblePoints.fitView;
|
|
1650
1657
|
break;
|
|
1651
1658
|
}
|
|
1652
|
-
if (typeof arg ===
|
|
1653
|
-
ary = arg.split(
|
|
1659
|
+
if (typeof arg === "string") {
|
|
1660
|
+
ary = arg.split(",");
|
|
1654
1661
|
} else if (arg instanceof Array) {
|
|
1655
1662
|
ary = arg;
|
|
1656
1663
|
}
|
|
@@ -1658,15 +1665,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1658
1665
|
var g = t.GM.getGraphicParam(ary[i]);
|
|
1659
1666
|
if (g) {
|
|
1660
1667
|
switch (g.geometry.type) {
|
|
1661
|
-
case
|
|
1668
|
+
case "point":
|
|
1662
1669
|
obj.push([g.geometry.x, g.geometry.y]);
|
|
1663
|
-
case
|
|
1670
|
+
case "circle":
|
|
1664
1671
|
obj.push([g.geometry.x, g.geometry.y]);
|
|
1665
1672
|
break;
|
|
1666
|
-
case
|
|
1673
|
+
case "polyline":
|
|
1667
1674
|
obj = [].concat(_toConsumableArray(obj), _toConsumableArray(g.geometry.paths));
|
|
1668
1675
|
break;
|
|
1669
|
-
case
|
|
1676
|
+
case "polygon":
|
|
1670
1677
|
obj = [].concat(_toConsumableArray(obj), _toConsumableArray(g.geometry.rings));
|
|
1671
1678
|
break;
|
|
1672
1679
|
}
|
|
@@ -1753,7 +1760,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1753
1760
|
lng = 0,
|
|
1754
1761
|
lat = 0;
|
|
1755
1762
|
switch (gp.geometryType) {
|
|
1756
|
-
case
|
|
1763
|
+
case "point":
|
|
1757
1764
|
lng = gp.geometry.x;
|
|
1758
1765
|
lat = gp.geometry.y;
|
|
1759
1766
|
p = _objectSpread(_objectSpread({}, gp), {}, {
|
|
@@ -1772,7 +1779,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1772
1779
|
})
|
|
1773
1780
|
});
|
|
1774
1781
|
break;
|
|
1775
|
-
case
|
|
1782
|
+
case "polyline":
|
|
1776
1783
|
pts = gp.geometry.paths;
|
|
1777
1784
|
p = _objectSpread(_objectSpread({}, gp), {}, {
|
|
1778
1785
|
mapLayer: gg,
|
|
@@ -1787,7 +1794,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1787
1794
|
})
|
|
1788
1795
|
});
|
|
1789
1796
|
break;
|
|
1790
|
-
case
|
|
1797
|
+
case "polygon":
|
|
1791
1798
|
pts = gp.geometry.rings;
|
|
1792
1799
|
p = _objectSpread(_objectSpread({}, gp), {}, {
|
|
1793
1800
|
mapLayer: gg,
|
|
@@ -1803,7 +1810,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1803
1810
|
area: (0, _MapToolFunction.getPolygonArea)(pts)
|
|
1804
1811
|
});
|
|
1805
1812
|
break;
|
|
1806
|
-
case
|
|
1813
|
+
case "circle":
|
|
1807
1814
|
lng = gp.geometry.x;
|
|
1808
1815
|
lat = gp.geometry.y;
|
|
1809
1816
|
var radius = gp.geometry.radius;
|
|
@@ -1833,7 +1840,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1833
1840
|
}, {
|
|
1834
1841
|
key: "parseDom",
|
|
1835
1842
|
value: function parseDom(domStr) {
|
|
1836
|
-
var domObj = document.createElement(
|
|
1843
|
+
var domObj = document.createElement("div");
|
|
1837
1844
|
domObj.innerHTML = domStr;
|
|
1838
1845
|
return domObj.childNodes;
|
|
1839
1846
|
}
|
|
@@ -1931,20 +1938,20 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1931
1938
|
parameter = _ref2$parameter === void 0 ? {} : _ref2$parameter,
|
|
1932
1939
|
_ref2$data = _ref2.data,
|
|
1933
1940
|
data = _ref2$data === void 0 ? {} : _ref2$data;
|
|
1934
|
-
if (![
|
|
1941
|
+
if (!["polygon", "circle", "rectangle"].includes(geometryType)) {
|
|
1935
1942
|
message.warn("传入的类型不支持框选!");
|
|
1936
1943
|
return false;
|
|
1937
1944
|
}
|
|
1938
1945
|
var t = this;
|
|
1939
1946
|
var params = {},
|
|
1940
|
-
type = geometryType ||
|
|
1947
|
+
type = geometryType || "polygon",
|
|
1941
1948
|
id = data.id || "frameSelectFeature_".concat(Math.random());
|
|
1942
|
-
params.color = parameter.color ||
|
|
1943
|
-
params.lineColor = parameter.lineColor ||
|
|
1949
|
+
params.color = parameter.color || "#FF0000";
|
|
1950
|
+
params.lineColor = parameter.lineColor || "#FF0000";
|
|
1944
1951
|
params.lineOpacity = parameter.lineOpacity || 1;
|
|
1945
1952
|
params.lineWidth = parameter.lineWidth || 2;
|
|
1946
1953
|
params.pellucidity = parameter.pellucidity || 0.6;
|
|
1947
|
-
params.lineType = parameter.lineType ||
|
|
1954
|
+
params.lineType = parameter.lineType || "solid";
|
|
1948
1955
|
t.draw({
|
|
1949
1956
|
geometryType: type,
|
|
1950
1957
|
parameter: _objectSpread(_objectSpread({}, parameter), params),
|
|
@@ -1975,13 +1982,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1975
1982
|
this.removeGraphic(obj.id, obj.type);
|
|
1976
1983
|
delete this.frameSelectProps[id];
|
|
1977
1984
|
}
|
|
1978
|
-
/*
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
+
/*
|
|
1986
|
+
* 添加信息窗口
|
|
1987
|
+
* params
|
|
1988
|
+
* @position: Array[longitude,latitude]
|
|
1989
|
+
* @content: String|HTML
|
|
1990
|
+
* @close: boolean
|
|
1991
|
+
*/
|
|
1985
1992
|
}, {
|
|
1986
1993
|
key: "showInfoWindow",
|
|
1987
1994
|
value: function showInfoWindow() {
|
|
@@ -2036,7 +2043,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2036
2043
|
var cg = {
|
|
2037
2044
|
width: 30,
|
|
2038
2045
|
height: 30,
|
|
2039
|
-
labelContent:
|
|
2046
|
+
labelContent: "",
|
|
2040
2047
|
labelPixelX: 0,
|
|
2041
2048
|
labelPixelY: 34,
|
|
2042
2049
|
markerContentX: -13,
|
|
@@ -2064,7 +2071,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2064
2071
|
var pop = new ol.Overlay({
|
|
2065
2072
|
id: item.id,
|
|
2066
2073
|
position: [parseFloat(item.longitude), parseFloat(item.latitude)],
|
|
2067
|
-
positioning:
|
|
2074
|
+
positioning: "center-center",
|
|
2068
2075
|
element: nodes,
|
|
2069
2076
|
autoPanMargin: 20,
|
|
2070
2077
|
autoPan: true,
|
|
@@ -2084,8 +2091,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2084
2091
|
style = new ol.style.Style({
|
|
2085
2092
|
image: new ol.style.Icon({
|
|
2086
2093
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
2087
|
-
anchorXUnits:
|
|
2088
|
-
anchorYUnits:
|
|
2094
|
+
anchorXUnits: "pixels",
|
|
2095
|
+
anchorYUnits: "pixels",
|
|
2089
2096
|
img: myImage,
|
|
2090
2097
|
imgSize: [cg.width, cg.height],
|
|
2091
2098
|
opacity: cg.opacity,
|
|
@@ -2095,11 +2102,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2095
2102
|
}
|
|
2096
2103
|
if (!!item.canShowLabel && item.canShowLabel) {
|
|
2097
2104
|
var textStyle = _objectSpread({
|
|
2098
|
-
textAlign:
|
|
2105
|
+
textAlign: "center",
|
|
2099
2106
|
//对齐方式
|
|
2100
|
-
textBaseline:
|
|
2107
|
+
textBaseline: "middle",
|
|
2101
2108
|
//文本基线
|
|
2102
|
-
font:
|
|
2109
|
+
font: "normal 12px 微软雅黑",
|
|
2103
2110
|
//字体样式
|
|
2104
2111
|
text: cg.labelContent,
|
|
2105
2112
|
//文本内容
|
|
@@ -2109,21 +2116,21 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2109
2116
|
// Y轴偏置
|
|
2110
2117
|
fill: new ol.style.Fill({
|
|
2111
2118
|
//填充样式
|
|
2112
|
-
color:
|
|
2119
|
+
color: "#1890ff"
|
|
2113
2120
|
}),
|
|
2114
2121
|
backgroundFill: new ol.style.Fill({
|
|
2115
2122
|
// 填充背景
|
|
2116
|
-
color:
|
|
2123
|
+
color: "rgba(255, 255, 255, 1)"
|
|
2117
2124
|
}),
|
|
2118
2125
|
padding: [2, 5, 2, 5]
|
|
2119
2126
|
}, cg.labelStyle || {});
|
|
2120
2127
|
if (cg.labelStyle && cg.labelStyle.fill) {
|
|
2121
|
-
textStyle[
|
|
2128
|
+
textStyle["fill"] = new ol.style.Fill({
|
|
2122
2129
|
color: cg.labelStyle.fill
|
|
2123
2130
|
});
|
|
2124
2131
|
}
|
|
2125
2132
|
if (cg.labelStyle && cg.labelStyle.backgroundFill) {
|
|
2126
|
-
textStyle[
|
|
2133
|
+
textStyle["backgroundFill"] = new ol.style.Fill({
|
|
2127
2134
|
color: cg.labelStyle.backgroundFill
|
|
2128
2135
|
});
|
|
2129
2136
|
}
|
|
@@ -2131,8 +2138,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2131
2138
|
style = new ol.style.Style({
|
|
2132
2139
|
image: new ol.style.Icon({
|
|
2133
2140
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
2134
|
-
anchorXUnits:
|
|
2135
|
-
anchorYUnits:
|
|
2141
|
+
anchorXUnits: "pixels",
|
|
2142
|
+
anchorYUnits: "pixels",
|
|
2136
2143
|
// src: item.url || require("../images/defaultMarker.png"),
|
|
2137
2144
|
img: myImage,
|
|
2138
2145
|
imgSize: [cg.width, cg.height],
|
|
@@ -2147,11 +2154,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2147
2154
|
// 初始化适量数据源
|
|
2148
2155
|
var source = new ol.source.Vector({
|
|
2149
2156
|
features: [feature],
|
|
2150
|
-
name:
|
|
2157
|
+
name: "point",
|
|
2151
2158
|
id: item.id
|
|
2152
2159
|
});
|
|
2153
2160
|
var pointLayer = new ol.layer.Vector({
|
|
2154
|
-
name:
|
|
2161
|
+
name: "point",
|
|
2155
2162
|
source: source,
|
|
2156
2163
|
id: item.id,
|
|
2157
2164
|
zIndex: t.pointLayerZIndex
|
|
@@ -2173,16 +2180,16 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2173
2180
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2174
2181
|
other: item
|
|
2175
2182
|
}),
|
|
2176
|
-
geometryType:
|
|
2183
|
+
geometryType: "point",
|
|
2177
2184
|
geometry: {
|
|
2178
|
-
type:
|
|
2185
|
+
type: "point",
|
|
2179
2186
|
x: parseFloat(item.longitude),
|
|
2180
2187
|
y: parseFloat(item.latitude)
|
|
2181
2188
|
},
|
|
2182
2189
|
source: source
|
|
2183
2190
|
});
|
|
2184
2191
|
});
|
|
2185
|
-
if (type !==
|
|
2192
|
+
if (type !== "defined") {
|
|
2186
2193
|
// t.state.pointIds = psids;
|
|
2187
2194
|
t.setState({
|
|
2188
2195
|
pointIds: psids
|
|
@@ -2197,7 +2204,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2197
2204
|
var mapPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2198
2205
|
var t = this;
|
|
2199
2206
|
var index = 0;
|
|
2200
|
-
var
|
|
2207
|
+
var dealPoint = function dealPoint(item) {
|
|
2201
2208
|
if (_this4.GM.isRepetition(item.id)) {
|
|
2202
2209
|
//点位数据不符合,直接跳过
|
|
2203
2210
|
if (!item.longitude || !item.latitude) {
|
|
@@ -2209,7 +2216,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2209
2216
|
var cg = {
|
|
2210
2217
|
width: 30,
|
|
2211
2218
|
height: 30,
|
|
2212
|
-
labelContent:
|
|
2219
|
+
labelContent: "",
|
|
2213
2220
|
labelPixelX: 0,
|
|
2214
2221
|
labelPixelY: 34,
|
|
2215
2222
|
BAnimationType: 3,
|
|
@@ -2243,8 +2250,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2243
2250
|
});
|
|
2244
2251
|
icon = new ol.style.Icon({
|
|
2245
2252
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
2246
|
-
anchorXUnits:
|
|
2247
|
-
anchorYUnits:
|
|
2253
|
+
anchorXUnits: "pixels",
|
|
2254
|
+
anchorYUnits: "pixels",
|
|
2248
2255
|
// src: item.url || require("../images/defaultMarker.png"),
|
|
2249
2256
|
img: myImage,
|
|
2250
2257
|
imgSize: [cg.width, cg.height],
|
|
@@ -2254,11 +2261,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2254
2261
|
});
|
|
2255
2262
|
if (item.canShowLabel) {
|
|
2256
2263
|
var textStyle = _objectSpread({
|
|
2257
|
-
textAlign:
|
|
2264
|
+
textAlign: "center",
|
|
2258
2265
|
//对齐方式
|
|
2259
|
-
textBaseline:
|
|
2266
|
+
textBaseline: "middle",
|
|
2260
2267
|
//文本基线
|
|
2261
|
-
font:
|
|
2268
|
+
font: "normal 12px 微软雅黑",
|
|
2262
2269
|
//字体样式
|
|
2263
2270
|
text: cg.labelContent,
|
|
2264
2271
|
//文本内容
|
|
@@ -2268,21 +2275,21 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2268
2275
|
// Y轴偏置
|
|
2269
2276
|
fill: new ol.style.Fill({
|
|
2270
2277
|
//填充样式
|
|
2271
|
-
color:
|
|
2278
|
+
color: "#1890ff"
|
|
2272
2279
|
}),
|
|
2273
2280
|
backgroundFill: new ol.style.Fill({
|
|
2274
2281
|
// 填充背景
|
|
2275
|
-
color:
|
|
2282
|
+
color: "rgba(255, 255, 255, 1)"
|
|
2276
2283
|
}),
|
|
2277
2284
|
padding: [2, 5, 2, 5]
|
|
2278
2285
|
}, cg.labelStyle || {});
|
|
2279
2286
|
if (cg.labelStyle && cg.labelStyle.fill) {
|
|
2280
|
-
textStyle[
|
|
2287
|
+
textStyle["fill"] = new ol.style.Fill({
|
|
2281
2288
|
color: cg.labelStyle.fill
|
|
2282
2289
|
});
|
|
2283
2290
|
}
|
|
2284
2291
|
if (cg.labelStyle && cg.labelStyle.backgroundFill) {
|
|
2285
|
-
textStyle[
|
|
2292
|
+
textStyle["backgroundFill"] = new ol.style.Fill({
|
|
2286
2293
|
color: cg.labelStyle.backgroundFill
|
|
2287
2294
|
});
|
|
2288
2295
|
}
|
|
@@ -2304,9 +2311,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2304
2311
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2305
2312
|
other: item
|
|
2306
2313
|
}),
|
|
2307
|
-
geometryType:
|
|
2314
|
+
geometryType: "point",
|
|
2308
2315
|
geometry: {
|
|
2309
|
-
type:
|
|
2316
|
+
type: "point",
|
|
2310
2317
|
x: parseFloat(item.longitude),
|
|
2311
2318
|
y: parseFloat(item.latitude)
|
|
2312
2319
|
},
|
|
@@ -2318,15 +2325,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2318
2325
|
}
|
|
2319
2326
|
if (index < mapPoints.length - 1) {
|
|
2320
2327
|
requestIdleCallback(function () {
|
|
2321
|
-
return
|
|
2328
|
+
return dealPoint(mapPoints[++index]);
|
|
2322
2329
|
});
|
|
2323
2330
|
} else {
|
|
2324
2331
|
t.refresh();
|
|
2325
2332
|
}
|
|
2326
2333
|
};
|
|
2327
|
-
if (!(0,
|
|
2334
|
+
if (!(0, _isEmpty.default)(mapPoints)) {
|
|
2328
2335
|
requestIdleCallback(function () {
|
|
2329
|
-
return
|
|
2336
|
+
return dealPoint(mapPoints[index]);
|
|
2330
2337
|
});
|
|
2331
2338
|
}
|
|
2332
2339
|
}
|
|
@@ -2338,7 +2345,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2338
2345
|
var cg = {
|
|
2339
2346
|
width: 30,
|
|
2340
2347
|
height: 30,
|
|
2341
|
-
labelContent:
|
|
2348
|
+
labelContent: "",
|
|
2342
2349
|
labelPixelX: 0,
|
|
2343
2350
|
labelPixelY: 34,
|
|
2344
2351
|
markerContentX: -13,
|
|
@@ -2369,7 +2376,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2369
2376
|
var pop = new ol.Overlay({
|
|
2370
2377
|
id: item.id,
|
|
2371
2378
|
position: [parseFloat(item.longitude), parseFloat(item.latitude)],
|
|
2372
|
-
positioning:
|
|
2379
|
+
positioning: "center-center",
|
|
2373
2380
|
element: nodes,
|
|
2374
2381
|
autoPanMargin: 20,
|
|
2375
2382
|
autoPan: true,
|
|
@@ -2399,8 +2406,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2399
2406
|
style = new ol.style.Style({
|
|
2400
2407
|
image: new ol.style.Icon({
|
|
2401
2408
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
2402
|
-
anchorXUnits:
|
|
2403
|
-
anchorYUnits:
|
|
2409
|
+
anchorXUnits: "pixels",
|
|
2410
|
+
anchorYUnits: "pixels",
|
|
2404
2411
|
img: myImage,
|
|
2405
2412
|
imgSize: [cg.width, cg.height],
|
|
2406
2413
|
opacity: cg.opacity,
|
|
@@ -2410,11 +2417,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2410
2417
|
}
|
|
2411
2418
|
if (!!item.canShowLabel && item.canShowLabel) {
|
|
2412
2419
|
var textStyle = _objectSpread({
|
|
2413
|
-
textAlign:
|
|
2420
|
+
textAlign: "center",
|
|
2414
2421
|
//对齐方式
|
|
2415
|
-
textBaseline:
|
|
2422
|
+
textBaseline: "middle",
|
|
2416
2423
|
//文本基线
|
|
2417
|
-
font:
|
|
2424
|
+
font: "normal 12px 微软雅黑",
|
|
2418
2425
|
//字体样式
|
|
2419
2426
|
text: cg.labelContent,
|
|
2420
2427
|
//文本内容
|
|
@@ -2424,21 +2431,21 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2424
2431
|
// Y轴偏置
|
|
2425
2432
|
fill: new ol.style.Fill({
|
|
2426
2433
|
//填充样式
|
|
2427
|
-
color:
|
|
2434
|
+
color: "#1890ff"
|
|
2428
2435
|
}),
|
|
2429
2436
|
backgroundFill: new ol.style.Fill({
|
|
2430
2437
|
// 填充背景
|
|
2431
|
-
color:
|
|
2438
|
+
color: "rgba(255, 255, 255, 1)"
|
|
2432
2439
|
}),
|
|
2433
2440
|
padding: [2, 5, 2, 5]
|
|
2434
2441
|
}, cg.labelStyle || {});
|
|
2435
2442
|
if (cg.labelStyle && cg.labelStyle.fill) {
|
|
2436
|
-
textStyle[
|
|
2443
|
+
textStyle["fill"] = new ol.style.Fill({
|
|
2437
2444
|
color: cg.labelStyle.fill
|
|
2438
2445
|
});
|
|
2439
2446
|
}
|
|
2440
2447
|
if (cg.labelStyle && cg.labelStyle.backgroundFill) {
|
|
2441
|
-
textStyle[
|
|
2448
|
+
textStyle["backgroundFill"] = new ol.style.Fill({
|
|
2442
2449
|
color: cg.labelStyle.backgroundFill
|
|
2443
2450
|
});
|
|
2444
2451
|
}
|
|
@@ -2446,8 +2453,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2446
2453
|
style = new ol.style.Style({
|
|
2447
2454
|
image: new ol.style.Icon({
|
|
2448
2455
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
2449
|
-
anchorXUnits:
|
|
2450
|
-
anchorYUnits:
|
|
2456
|
+
anchorXUnits: "pixels",
|
|
2457
|
+
anchorYUnits: "pixels",
|
|
2451
2458
|
// src: item.url || require("../images/defaultMarker.png"),
|
|
2452
2459
|
img: myImage,
|
|
2453
2460
|
imgSize: [cg.width, cg.height],
|
|
@@ -2481,9 +2488,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2481
2488
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2482
2489
|
other: item
|
|
2483
2490
|
}),
|
|
2484
|
-
geometryType:
|
|
2491
|
+
geometryType: "point",
|
|
2485
2492
|
geometry: {
|
|
2486
|
-
type:
|
|
2493
|
+
type: "point",
|
|
2487
2494
|
x: parseFloat(item.longitude),
|
|
2488
2495
|
y: parseFloat(item.latitude)
|
|
2489
2496
|
}
|
|
@@ -2524,9 +2531,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2524
2531
|
features: features
|
|
2525
2532
|
});
|
|
2526
2533
|
var pointLayer = new ol.layer.Vector({
|
|
2527
|
-
name:
|
|
2534
|
+
name: "point_layer",
|
|
2528
2535
|
source: _source,
|
|
2529
|
-
id:
|
|
2536
|
+
id: "point_layer",
|
|
2530
2537
|
zIndex: t.pointLayerZIndex
|
|
2531
2538
|
});
|
|
2532
2539
|
t.state.gis.addLayer(pointLayer);
|
|
@@ -2540,8 +2547,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2540
2547
|
value: function refresh() {
|
|
2541
2548
|
var t = this;
|
|
2542
2549
|
var timer = setTimeout(function () {
|
|
2550
|
+
var _window$VtxMap$t$prop;
|
|
2543
2551
|
clearTimeout(timer);
|
|
2544
|
-
window.VtxMap[t.props.mapId].redrawText();
|
|
2552
|
+
(_window$VtxMap$t$prop = window.VtxMap[t.props.mapId]) === null || _window$VtxMap$t$prop === void 0 || _window$VtxMap$t$prop.redrawText();
|
|
2545
2553
|
}, 100);
|
|
2546
2554
|
}
|
|
2547
2555
|
// 添加先
|
|
@@ -2565,10 +2573,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2565
2573
|
return false;
|
|
2566
2574
|
}
|
|
2567
2575
|
var cg = {
|
|
2568
|
-
color:
|
|
2576
|
+
color: "#277ffa",
|
|
2569
2577
|
pellucidity: 0.9,
|
|
2570
2578
|
lineWidth: 5,
|
|
2571
|
-
lineType:
|
|
2579
|
+
lineType: "solid",
|
|
2572
2580
|
isHidden: false
|
|
2573
2581
|
};
|
|
2574
2582
|
if (item.config) {
|
|
@@ -2578,7 +2586,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2578
2586
|
stroke: new ol.style.Stroke({
|
|
2579
2587
|
color: cg.color,
|
|
2580
2588
|
width: cg.lineWidth,
|
|
2581
|
-
lineDash: cg.lineType ==
|
|
2589
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined
|
|
2582
2590
|
})
|
|
2583
2591
|
});
|
|
2584
2592
|
var polyline = new ol.Feature({
|
|
@@ -2589,11 +2597,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2589
2597
|
polyline.setStyle(style);
|
|
2590
2598
|
var source = new ol.source.Vector({
|
|
2591
2599
|
features: [polyline],
|
|
2592
|
-
name:
|
|
2600
|
+
name: "polyline",
|
|
2593
2601
|
id: item.id
|
|
2594
2602
|
});
|
|
2595
2603
|
var lineLayer = new ol.layer.Vector({
|
|
2596
|
-
name:
|
|
2604
|
+
name: "polyline",
|
|
2597
2605
|
id: item.id,
|
|
2598
2606
|
source: source,
|
|
2599
2607
|
zIndex: t.polylineLayerZIndex
|
|
@@ -2608,9 +2616,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2608
2616
|
paths: pts,
|
|
2609
2617
|
other: item
|
|
2610
2618
|
}),
|
|
2611
|
-
geometryType:
|
|
2619
|
+
geometryType: "polyline",
|
|
2612
2620
|
geometry: {
|
|
2613
|
-
type:
|
|
2621
|
+
type: "polyline",
|
|
2614
2622
|
paths: pts
|
|
2615
2623
|
},
|
|
2616
2624
|
source: source
|
|
@@ -2619,7 +2627,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2619
2627
|
lsids.push(item.id);
|
|
2620
2628
|
t.state.lineIds.push(item.id);
|
|
2621
2629
|
});
|
|
2622
|
-
if (type !==
|
|
2630
|
+
if (type !== "defined") {
|
|
2623
2631
|
t.state.lineIds = lsids;
|
|
2624
2632
|
}
|
|
2625
2633
|
}
|
|
@@ -2640,10 +2648,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2640
2648
|
}
|
|
2641
2649
|
//初始化默认参数
|
|
2642
2650
|
var cg = {
|
|
2643
|
-
color:
|
|
2651
|
+
color: "#277ffa",
|
|
2644
2652
|
pellucidity: 0.9,
|
|
2645
2653
|
lineWidth: 5,
|
|
2646
|
-
lineType:
|
|
2654
|
+
lineType: "solid",
|
|
2647
2655
|
//'solid' 'dashed'
|
|
2648
2656
|
isHidden: false
|
|
2649
2657
|
};
|
|
@@ -2661,7 +2669,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2661
2669
|
stroke: new ol.style.Stroke({
|
|
2662
2670
|
color: cg.color,
|
|
2663
2671
|
width: cg.lineWidth,
|
|
2664
|
-
lineDash: cg.lineType ==
|
|
2672
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined,
|
|
2665
2673
|
zIndex: cg.zIndex || 0
|
|
2666
2674
|
})
|
|
2667
2675
|
});
|
|
@@ -2674,9 +2682,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2674
2682
|
paths: pts,
|
|
2675
2683
|
other: item
|
|
2676
2684
|
}),
|
|
2677
|
-
geometryType:
|
|
2685
|
+
geometryType: "polyline",
|
|
2678
2686
|
geometry: {
|
|
2679
|
-
type:
|
|
2687
|
+
type: "polyline",
|
|
2680
2688
|
paths: pts
|
|
2681
2689
|
},
|
|
2682
2690
|
source: gp.source
|
|
@@ -2708,11 +2716,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2708
2716
|
return false;
|
|
2709
2717
|
}
|
|
2710
2718
|
var cg = {
|
|
2711
|
-
lineType:
|
|
2719
|
+
lineType: "solid",
|
|
2712
2720
|
lineWidth: 5,
|
|
2713
|
-
lineColor:
|
|
2721
|
+
lineColor: "#277ffa",
|
|
2714
2722
|
lineOpacity: 1,
|
|
2715
|
-
color:
|
|
2723
|
+
color: "#fff",
|
|
2716
2724
|
pellucidity: 0.5
|
|
2717
2725
|
};
|
|
2718
2726
|
if (item.config) {
|
|
@@ -2722,7 +2730,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2722
2730
|
stroke: new ol.style.Stroke({
|
|
2723
2731
|
color: cg.lineColor,
|
|
2724
2732
|
width: cg.lineWidth,
|
|
2725
|
-
lineDash: cg.lineType ==
|
|
2733
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined
|
|
2726
2734
|
}),
|
|
2727
2735
|
fill: new ol.style.Fill({
|
|
2728
2736
|
color: cg.pellucidity ? getRgbColor(cg.color, cg.pellucidity) : cg.color
|
|
@@ -2732,7 +2740,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2732
2740
|
geometry: new ol.geom.Polygon([item.rings]),
|
|
2733
2741
|
id: item.id,
|
|
2734
2742
|
params: _objectSpread({}, item),
|
|
2735
|
-
name:
|
|
2743
|
+
name: "polygon"
|
|
2736
2744
|
});
|
|
2737
2745
|
polygon.setStyle(style);
|
|
2738
2746
|
var source = new ol.source.Vector({
|
|
@@ -2740,7 +2748,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2740
2748
|
id: item.id
|
|
2741
2749
|
});
|
|
2742
2750
|
var polygonLayer = new ol.layer.Vector({
|
|
2743
|
-
name:
|
|
2751
|
+
name: "polygon",
|
|
2744
2752
|
id: item.id,
|
|
2745
2753
|
source: source,
|
|
2746
2754
|
zIndex: t.polygonLayerZIndex
|
|
@@ -2755,9 +2763,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2755
2763
|
rings: pts,
|
|
2756
2764
|
other: item
|
|
2757
2765
|
}),
|
|
2758
|
-
geometryType:
|
|
2766
|
+
geometryType: "polygon",
|
|
2759
2767
|
geometry: {
|
|
2760
|
-
type:
|
|
2768
|
+
type: "polygon",
|
|
2761
2769
|
rings: pts
|
|
2762
2770
|
},
|
|
2763
2771
|
source: source
|
|
@@ -2786,11 +2794,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2786
2794
|
var gp = t.GM.getGraphicParam(item.id);
|
|
2787
2795
|
//获取原有的面属性,转换key值
|
|
2788
2796
|
var cg = {
|
|
2789
|
-
lineType:
|
|
2797
|
+
lineType: "solid",
|
|
2790
2798
|
lineWidth: 5,
|
|
2791
|
-
lineColor:
|
|
2799
|
+
lineColor: "#277ffa",
|
|
2792
2800
|
lineOpacity: 1,
|
|
2793
|
-
color:
|
|
2801
|
+
color: "#fff",
|
|
2794
2802
|
pellucidity: 0.5
|
|
2795
2803
|
};
|
|
2796
2804
|
//重新初始化值
|
|
@@ -2805,7 +2813,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2805
2813
|
stroke: new ol.style.Stroke({
|
|
2806
2814
|
color: cg.lineColor,
|
|
2807
2815
|
width: cg.lineWidth,
|
|
2808
|
-
lineDash: cg.lineType ==
|
|
2816
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined
|
|
2809
2817
|
}),
|
|
2810
2818
|
fill: new ol.style.Fill({
|
|
2811
2819
|
color: cg.pellucidity ? getRgbColor(cg.color, cg.pellucidity) : cg.color
|
|
@@ -2816,9 +2824,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2816
2824
|
rings: pts,
|
|
2817
2825
|
other: item
|
|
2818
2826
|
}),
|
|
2819
|
-
geometryType:
|
|
2827
|
+
geometryType: "polygon",
|
|
2820
2828
|
geometry: {
|
|
2821
|
-
type:
|
|
2829
|
+
type: "polygon",
|
|
2822
2830
|
rings: pts
|
|
2823
2831
|
},
|
|
2824
2832
|
source: gp.source
|
|
@@ -2850,11 +2858,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2850
2858
|
return false;
|
|
2851
2859
|
}
|
|
2852
2860
|
var cg = {
|
|
2853
|
-
lineType:
|
|
2861
|
+
lineType: "solid",
|
|
2854
2862
|
lineWidth: 5,
|
|
2855
|
-
lineColor:
|
|
2863
|
+
lineColor: "#277ffa",
|
|
2856
2864
|
lineOpacity: 1,
|
|
2857
|
-
color:
|
|
2865
|
+
color: "#fff",
|
|
2858
2866
|
pellucidity: 0.5
|
|
2859
2867
|
// isHidden: false //后期需要在加
|
|
2860
2868
|
};
|
|
@@ -2865,7 +2873,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2865
2873
|
stroke: new ol.style.Stroke({
|
|
2866
2874
|
color: cg.lineColor,
|
|
2867
2875
|
width: cg.lineWidth,
|
|
2868
|
-
lineDash: cg.lineType ==
|
|
2876
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined
|
|
2869
2877
|
}),
|
|
2870
2878
|
fill: new ol.style.Fill({
|
|
2871
2879
|
color: cg.pellucidity ? getRgbColor(cg.color, cg.pellucidity) : cg.color
|
|
@@ -2877,16 +2885,16 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2877
2885
|
geometry: new ol.geom.Circle([item.longitude, item.latitude], parseFloat(circleRadius)),
|
|
2878
2886
|
id: item.id,
|
|
2879
2887
|
params: _objectSpread({}, item),
|
|
2880
|
-
name:
|
|
2888
|
+
name: "circle"
|
|
2881
2889
|
});
|
|
2882
2890
|
circle.setStyle(style);
|
|
2883
2891
|
var source = new ol.source.Vector({
|
|
2884
2892
|
features: [circle],
|
|
2885
|
-
name:
|
|
2893
|
+
name: "circle",
|
|
2886
2894
|
id: item.id
|
|
2887
2895
|
});
|
|
2888
2896
|
var circleLayer = new ol.layer.Vector({
|
|
2889
|
-
name:
|
|
2897
|
+
name: "circle",
|
|
2890
2898
|
id: item.id,
|
|
2891
2899
|
source: source,
|
|
2892
2900
|
zIndex: t.polygonLayerZIndex
|
|
@@ -2897,9 +2905,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2897
2905
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2898
2906
|
other: item
|
|
2899
2907
|
}),
|
|
2900
|
-
geometryType:
|
|
2908
|
+
geometryType: "circle",
|
|
2901
2909
|
geometry: {
|
|
2902
|
-
type:
|
|
2910
|
+
type: "circle",
|
|
2903
2911
|
x: parseFloat(item.longitude),
|
|
2904
2912
|
y: parseFloat(item.latitude),
|
|
2905
2913
|
radius: parseFloat(item.radius)
|
|
@@ -2936,11 +2944,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2936
2944
|
var gp = t.GM.getGraphicParam(item.id);
|
|
2937
2945
|
//获取原有的面属性,转换key值
|
|
2938
2946
|
var cg = {
|
|
2939
|
-
lineType:
|
|
2947
|
+
lineType: "solid",
|
|
2940
2948
|
lineWidth: 5,
|
|
2941
|
-
lineColor:
|
|
2949
|
+
lineColor: "#277ffa",
|
|
2942
2950
|
lineOpacity: 1,
|
|
2943
|
-
color:
|
|
2951
|
+
color: "#fff",
|
|
2944
2952
|
pellucidity: 0.5
|
|
2945
2953
|
// isHidden: false //后期需要在加
|
|
2946
2954
|
};
|
|
@@ -2954,7 +2962,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2954
2962
|
stroke: new ol.style.Stroke({
|
|
2955
2963
|
color: cg.lineColor,
|
|
2956
2964
|
width: cg.lineWidth,
|
|
2957
|
-
lineDash: cg.lineType ==
|
|
2965
|
+
lineDash: cg.lineType == "dashed" ? [2] : undefined
|
|
2958
2966
|
}),
|
|
2959
2967
|
fill: new ol.style.Fill({
|
|
2960
2968
|
color: cg.pellucidity ? getRgbColor(cg.color, cg.pellucidity) : cg.color
|
|
@@ -2964,9 +2972,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2964
2972
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
2965
2973
|
other: item
|
|
2966
2974
|
}),
|
|
2967
|
-
geometryType:
|
|
2975
|
+
geometryType: "circle",
|
|
2968
2976
|
geometry: {
|
|
2969
|
-
type:
|
|
2977
|
+
type: "circle",
|
|
2970
2978
|
x: parseFloat(item.longitude),
|
|
2971
2979
|
y: parseFloat(item.latitude),
|
|
2972
2980
|
radius: parseFloat(item.radius)
|
|
@@ -3014,19 +3022,19 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3014
3022
|
}
|
|
3015
3023
|
var ids = [];
|
|
3016
3024
|
switch (type) {
|
|
3017
|
-
case
|
|
3025
|
+
case "point":
|
|
3018
3026
|
ids = t.state.pointIds;
|
|
3019
3027
|
break;
|
|
3020
|
-
case
|
|
3028
|
+
case "line":
|
|
3021
3029
|
ids = t.state.lineIds;
|
|
3022
3030
|
break;
|
|
3023
|
-
case
|
|
3031
|
+
case "polygon":
|
|
3024
3032
|
ids = t.state.polygonIds;
|
|
3025
3033
|
break;
|
|
3026
|
-
case
|
|
3034
|
+
case "circle":
|
|
3027
3035
|
ids = t.state.circleIds;
|
|
3028
3036
|
break;
|
|
3029
|
-
case
|
|
3037
|
+
case "draw":
|
|
3030
3038
|
if (t.state.drawIds.point.indexOf(id) > -1) {
|
|
3031
3039
|
t.state.drawIds.point.splice(t.state.drawIds.point.indexOf(id), 1);
|
|
3032
3040
|
}
|
|
@@ -3059,7 +3067,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3059
3067
|
break;
|
|
3060
3068
|
}
|
|
3061
3069
|
if (id == t.state.editId) {
|
|
3062
|
-
t.state.editId =
|
|
3070
|
+
t.state.editId = "";
|
|
3063
3071
|
}
|
|
3064
3072
|
if (ids.indexOf(id) != -1) {
|
|
3065
3073
|
ids.splice(ids.indexOf(id), 1);
|
|
@@ -3075,7 +3083,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3075
3083
|
//清空热力图
|
|
3076
3084
|
if (t.heatmap) {
|
|
3077
3085
|
var hMap = layers.filter(function (item) {
|
|
3078
|
-
return item.name ==
|
|
3086
|
+
return item.name == "heatMap";
|
|
3079
3087
|
})[0];
|
|
3080
3088
|
hMap.getSource().clear();
|
|
3081
3089
|
gis.removeLayer(layer);
|
|
@@ -3115,19 +3123,19 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3115
3123
|
cs = _toConsumableArray(circleIds);
|
|
3116
3124
|
// 删除点
|
|
3117
3125
|
for (var i = 0; i < ps.length; i++) {
|
|
3118
|
-
t.removeGraphic(ps[i],
|
|
3126
|
+
t.removeGraphic(ps[i], "point");
|
|
3119
3127
|
}
|
|
3120
3128
|
// 删除线
|
|
3121
3129
|
for (var _i = 0; _i < ls.length; _i++) {
|
|
3122
|
-
t.removeGraphic(ls[_i],
|
|
3130
|
+
t.removeGraphic(ls[_i], "line");
|
|
3123
3131
|
}
|
|
3124
3132
|
// 删除面
|
|
3125
3133
|
for (var _i2 = 0; _i2 < pgs.length; _i2++) {
|
|
3126
|
-
t.removeGraphic(pgs[_i2],
|
|
3134
|
+
t.removeGraphic(pgs[_i2], "polygon");
|
|
3127
3135
|
}
|
|
3128
3136
|
// 删除圆
|
|
3129
3137
|
for (var _i3 = 0; _i3 < cs.length; _i3++) {
|
|
3130
|
-
t.removeGraphic(cs[_i3],
|
|
3138
|
+
t.removeGraphic(cs[_i3], "circle");
|
|
3131
3139
|
}
|
|
3132
3140
|
//删除绘制的点
|
|
3133
3141
|
var point = drawIds.point,
|
|
@@ -3162,39 +3170,39 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3162
3170
|
gis.removeControl(t.scaleControl);
|
|
3163
3171
|
}
|
|
3164
3172
|
t.scaleControl = new ol.control.ScaleLine({
|
|
3165
|
-
units:
|
|
3173
|
+
units: "metric",
|
|
3166
3174
|
//设置度量单位
|
|
3167
3175
|
className: "ol-scale-line-".concat(config.location)
|
|
3168
3176
|
});
|
|
3169
3177
|
gis.addControl(t.scaleControl);
|
|
3170
3178
|
setTimeout(function () {
|
|
3171
|
-
if (config.location ==
|
|
3179
|
+
if (config.location == "tl") {
|
|
3172
3180
|
$("div.ol-scale-line-".concat(config.location)).css({
|
|
3173
|
-
position:
|
|
3181
|
+
position: "absolute",
|
|
3174
3182
|
left: config.offset ? config.offset[0] : 0 + 65,
|
|
3175
3183
|
top: config.offset ? config.offset[1] : 0,
|
|
3176
|
-
textAlign:
|
|
3184
|
+
textAlign: "center"
|
|
3177
3185
|
});
|
|
3178
|
-
} else if (config.location ==
|
|
3186
|
+
} else if (config.location == "bl") {
|
|
3179
3187
|
$("div.ol-scale-line-".concat(config.location)).css({
|
|
3180
|
-
position:
|
|
3188
|
+
position: "absolute",
|
|
3181
3189
|
left: config.offset ? config.offset[0] : 0 + 65,
|
|
3182
3190
|
bottom: config.offset ? config.offset[1] : 0,
|
|
3183
|
-
textAlign:
|
|
3191
|
+
textAlign: "center"
|
|
3184
3192
|
});
|
|
3185
|
-
} else if (config.location ==
|
|
3193
|
+
} else if (config.location == "tr") {
|
|
3186
3194
|
$("div.ol-scale-line-".concat(config.location)).css({
|
|
3187
|
-
position:
|
|
3195
|
+
position: "absolute",
|
|
3188
3196
|
right: config.offset ? config.offset[0] : 0 + 65,
|
|
3189
3197
|
top: config.offset ? config.offset[1] : 0,
|
|
3190
|
-
textAlign:
|
|
3198
|
+
textAlign: "center"
|
|
3191
3199
|
});
|
|
3192
|
-
} else if (config.location ==
|
|
3200
|
+
} else if (config.location == "br") {
|
|
3193
3201
|
$("div.ol-scale-line-".concat(config.location)).css({
|
|
3194
|
-
position:
|
|
3202
|
+
position: "absolute",
|
|
3195
3203
|
right: config.offset ? config.offset[0] : 0 + 65,
|
|
3196
3204
|
bottom: config.offset ? config.offset[1] : 0,
|
|
3197
|
-
textAlign:
|
|
3205
|
+
textAlign: "center"
|
|
3198
3206
|
});
|
|
3199
3207
|
}
|
|
3200
3208
|
}, 20);
|
|
@@ -3257,10 +3265,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3257
3265
|
var pointIds = t.state.pointIds;
|
|
3258
3266
|
ary = pointIds;
|
|
3259
3267
|
} else {
|
|
3260
|
-
if (Object.prototype.toString.apply(arg) ===
|
|
3268
|
+
if (Object.prototype.toString.apply(arg) === "[object Array]") {
|
|
3261
3269
|
ary = arg;
|
|
3262
|
-
} else if (typeof arg ===
|
|
3263
|
-
ary = arg.split(
|
|
3270
|
+
} else if (typeof arg === "string") {
|
|
3271
|
+
ary = arg.split(",");
|
|
3264
3272
|
}
|
|
3265
3273
|
}
|
|
3266
3274
|
t.pointLayers.map(function (item) {
|
|
@@ -3269,7 +3277,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3269
3277
|
});
|
|
3270
3278
|
var ms = this.GM.getMoreGraphic(ary).filter(function (item, index) {
|
|
3271
3279
|
// return !item && item != 0 ? false : true;
|
|
3272
|
-
return item && item.getGeometry().getType() ===
|
|
3280
|
+
return item && item.getGeometry().getType() === "Point" && !item.label;
|
|
3273
3281
|
});
|
|
3274
3282
|
var source = new ol.source.Vector({
|
|
3275
3283
|
features: ms
|
|
@@ -3322,7 +3330,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3322
3330
|
if (cluster !== t.clusterInfo.clickFeature || resolution !== t.clusterInfo.clickResolution) {
|
|
3323
3331
|
return;
|
|
3324
3332
|
}
|
|
3325
|
-
var clusterMembers = cluster.get(
|
|
3333
|
+
var clusterMembers = cluster.get("features");
|
|
3326
3334
|
var centerCoordinates = cluster.getGeometry().getCoordinates();
|
|
3327
3335
|
return generatePointsCircle(clusterMembers.length, cluster.getGeometry().getCoordinates(), resolution).reduce(function (styles, coordinates, i) {
|
|
3328
3336
|
var point = new ol.geom.Point(coordinates);
|
|
@@ -3330,7 +3338,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3330
3338
|
styles.unshift(new ol.style.Style({
|
|
3331
3339
|
geometry: line,
|
|
3332
3340
|
stroke: new ol.style.Stroke({
|
|
3333
|
-
color:
|
|
3341
|
+
color: "rgba(204, 85, 0, 1)",
|
|
3334
3342
|
width: 1.5
|
|
3335
3343
|
})
|
|
3336
3344
|
}));
|
|
@@ -3358,51 +3366,51 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3358
3366
|
if (cluster !== t.clusterInfo.hoverFeature) {
|
|
3359
3367
|
return;
|
|
3360
3368
|
}
|
|
3361
|
-
var originalFeatures = cluster.get(
|
|
3369
|
+
var originalFeatures = cluster.get("features");
|
|
3362
3370
|
var points = originalFeatures.map(function (feature) {
|
|
3363
3371
|
return feature.getGeometry().getCoordinates();
|
|
3364
3372
|
});
|
|
3365
3373
|
return new ol.style.Style({
|
|
3366
3374
|
geometry: new ol.geom.Polygon(points),
|
|
3367
3375
|
fill: new ol.style.Fill({
|
|
3368
|
-
color:
|
|
3376
|
+
color: "rgba(255, 153, 0, 0.4)"
|
|
3369
3377
|
}),
|
|
3370
3378
|
stroke: new ol.style.Stroke({
|
|
3371
|
-
color:
|
|
3379
|
+
color: "rgba(204, 85, 0, 1)",
|
|
3372
3380
|
width: 1.5
|
|
3373
3381
|
})
|
|
3374
3382
|
});
|
|
3375
3383
|
}
|
|
3376
3384
|
function clusterStyle(feature) {
|
|
3377
|
-
var size = feature.get(
|
|
3385
|
+
var size = feature.get("features").length;
|
|
3378
3386
|
if (size > 2) {
|
|
3379
3387
|
return [new ol.style.Style({
|
|
3380
3388
|
image: new ol.style.Circle({
|
|
3381
3389
|
radius: 20,
|
|
3382
3390
|
fill: new ol.style.Fill({
|
|
3383
|
-
color:
|
|
3391
|
+
color: "rgba(255, 153, 102, 0.3)"
|
|
3384
3392
|
})
|
|
3385
3393
|
})
|
|
3386
3394
|
}), new ol.style.Style({
|
|
3387
3395
|
image: new ol.style.Circle({
|
|
3388
3396
|
radius: 14,
|
|
3389
3397
|
fill: new ol.style.Fill({
|
|
3390
|
-
color:
|
|
3398
|
+
color: "rgba(255, 165, 0, 0.7)"
|
|
3391
3399
|
})
|
|
3392
3400
|
}),
|
|
3393
3401
|
text: new ol.style.Text({
|
|
3394
3402
|
text: size.toString(),
|
|
3395
3403
|
fill: new ol.style.Fill({
|
|
3396
|
-
color:
|
|
3404
|
+
color: "#fff"
|
|
3397
3405
|
}),
|
|
3398
3406
|
stroke: new ol.style.Stroke({
|
|
3399
|
-
color:
|
|
3407
|
+
color: "rgba(0, 0, 0, 0.6)",
|
|
3400
3408
|
width: 3
|
|
3401
3409
|
})
|
|
3402
3410
|
})
|
|
3403
3411
|
})];
|
|
3404
3412
|
} else {
|
|
3405
|
-
return feature.get(
|
|
3413
|
+
return feature.get("features").map(function (originalFeature) {
|
|
3406
3414
|
return clusterMemberStyle(originalFeature);
|
|
3407
3415
|
});
|
|
3408
3416
|
}
|
|
@@ -3543,7 +3551,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3543
3551
|
if (!(tl.y < -50 || tl.x < -50 || tl.y > t.state.gis.height || tl.x > t.state.gis.width)) {
|
|
3544
3552
|
//设置label的位置(通过定位来实现)
|
|
3545
3553
|
label.html.css({
|
|
3546
|
-
position:
|
|
3554
|
+
position: "absolute",
|
|
3547
3555
|
top: tl.y + (label.offset.y || 0) - t.labelLayer.y,
|
|
3548
3556
|
left: tl.x + (label.offset.x || 0) - t.labelLayer.x
|
|
3549
3557
|
});
|
|
@@ -3636,8 +3644,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3636
3644
|
deleteIndex.sort(function (a, b) {
|
|
3637
3645
|
return b - a;
|
|
3638
3646
|
});
|
|
3639
|
-
for (var
|
|
3640
|
-
t.movePoints.splice(deleteIndex[
|
|
3647
|
+
for (var _i10 = 0; _i10 < deleteIndex.length; _i10++) {
|
|
3648
|
+
t.movePoints.splice(deleteIndex[_i10], 1);
|
|
3641
3649
|
}
|
|
3642
3650
|
if (nowMovePoints.length == 0) {
|
|
3643
3651
|
clearInterval(t.moveToTimer);
|
|
@@ -3745,7 +3753,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3745
3753
|
}, {
|
|
3746
3754
|
key: "deepEqual",
|
|
3747
3755
|
value: function deepEqual(a, b) {
|
|
3748
|
-
return _immutable
|
|
3756
|
+
return _immutable.default.is(_immutable.default.fromJS(a), _immutable.default.fromJS(b));
|
|
3749
3757
|
}
|
|
3750
3758
|
//数据解析(分析,新增,更新,删除对应的数据)
|
|
3751
3759
|
}, {
|
|
@@ -3820,11 +3828,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3820
3828
|
value: function render() {
|
|
3821
3829
|
var t = this;
|
|
3822
3830
|
var _map = this.props;
|
|
3823
|
-
return /*#__PURE__*/
|
|
3831
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
3824
3832
|
id: _map.mapId,
|
|
3825
3833
|
style: {
|
|
3826
|
-
width:
|
|
3827
|
-
height:
|
|
3834
|
+
width: "100%",
|
|
3835
|
+
height: "100%"
|
|
3828
3836
|
}
|
|
3829
3837
|
});
|
|
3830
3838
|
}
|
|
@@ -3897,11 +3905,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3897
3905
|
pointsFeature = _nextProps$pointsFeat === void 0 ? [] : _nextProps$pointsFeat;
|
|
3898
3906
|
// 等待地图加载
|
|
3899
3907
|
if (!t.mapCreated) return;
|
|
3900
|
-
/*点数据处理
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3908
|
+
/*点数据处理
|
|
3909
|
+
pointData[2]相同的点,执行刷新
|
|
3910
|
+
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
3911
|
+
pointData[0]数据中多余的id,执行删除
|
|
3912
|
+
*/
|
|
3905
3913
|
if (pointsFeature instanceof Array && !t.deepEqual(pointsFeature, t.props.pointsFeature)) {
|
|
3906
3914
|
t.addPointLayer(pointsFeature);
|
|
3907
3915
|
}
|
|
@@ -3917,7 +3925,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3917
3925
|
return item.id !== editGraphicId;
|
|
3918
3926
|
});
|
|
3919
3927
|
}
|
|
3920
|
-
var _t$dataMatch = t.dataMatch(oldMapPoints, newMapPoints,
|
|
3928
|
+
var _t$dataMatch = t.dataMatch(oldMapPoints, newMapPoints, "id"),
|
|
3921
3929
|
deletedDataIDs = _t$dataMatch.deletedDataIDs,
|
|
3922
3930
|
addedData = _t$dataMatch.addedData,
|
|
3923
3931
|
updatedData = _t$dataMatch.updatedData;
|
|
@@ -3929,26 +3937,26 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3929
3937
|
otherads = _t$dealUpdate.otherads;
|
|
3930
3938
|
//删在增之前,(因为增加后会刷新pointIds的值,造成多删的问题)
|
|
3931
3939
|
var index = 0;
|
|
3932
|
-
var
|
|
3933
|
-
t.removeGraphic(id,
|
|
3940
|
+
var removeGraphic = function removeGraphic(id) {
|
|
3941
|
+
t.removeGraphic(id, "point");
|
|
3934
3942
|
if (index < deletedDataIDs.length - 1) {
|
|
3935
3943
|
requestIdleCallback(function () {
|
|
3936
|
-
return
|
|
3944
|
+
return removeGraphic(deletedDataIDs[++index]);
|
|
3937
3945
|
});
|
|
3938
3946
|
}
|
|
3939
3947
|
};
|
|
3940
|
-
if (!(0,
|
|
3941
|
-
|
|
3948
|
+
if (!(0, _isEmpty.default)(deletedDataIDs)) {
|
|
3949
|
+
removeGraphic(deletedDataIDs[index]);
|
|
3942
3950
|
}
|
|
3943
3951
|
//增加
|
|
3944
3952
|
t.addPoint([].concat(_toConsumableArray(ads), _toConsumableArray(otherads)));
|
|
3945
3953
|
//更新
|
|
3946
3954
|
t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
|
|
3947
3955
|
}
|
|
3948
|
-
/*
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3956
|
+
/*
|
|
3957
|
+
线数据处理
|
|
3958
|
+
先全删除,再新增
|
|
3959
|
+
*/
|
|
3952
3960
|
if (mapLines instanceof Array && t.props.mapLines instanceof Array && !t.deepEqual(mapLines, t.props.mapLines)) {
|
|
3953
3961
|
var oldMapLines = t.props.mapLines;
|
|
3954
3962
|
var newMapLines = mapLines;
|
|
@@ -3960,7 +3968,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3960
3968
|
return item.id !== editGraphicId;
|
|
3961
3969
|
});
|
|
3962
3970
|
}
|
|
3963
|
-
var _t$dataMatch2 = t.dataMatch(oldMapLines, newMapLines,
|
|
3971
|
+
var _t$dataMatch2 = t.dataMatch(oldMapLines, newMapLines, "id"),
|
|
3964
3972
|
_deletedDataIDs = _t$dataMatch2.deletedDataIDs,
|
|
3965
3973
|
_addedData = _t$dataMatch2.addedData,
|
|
3966
3974
|
_updatedData = _t$dataMatch2.updatedData;
|
|
@@ -3976,7 +3984,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3976
3984
|
try {
|
|
3977
3985
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3978
3986
|
var id = _step.value;
|
|
3979
|
-
t.removeGraphic(id,
|
|
3987
|
+
t.removeGraphic(id, "line");
|
|
3980
3988
|
}
|
|
3981
3989
|
//增加
|
|
3982
3990
|
} catch (err) {
|
|
@@ -3988,10 +3996,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3988
3996
|
//更新
|
|
3989
3997
|
t.updateLine([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
|
|
3990
3998
|
}
|
|
3991
|
-
/*
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3999
|
+
/*
|
|
4000
|
+
面数据处理
|
|
4001
|
+
先全删除,再新增
|
|
4002
|
+
*/
|
|
3995
4003
|
if (mapPolygons instanceof Array && t.props.mapPolygons instanceof Array && !t.deepEqual(mapPolygons, t.props.mapPolygons)) {
|
|
3996
4004
|
var oldMapPolygons = t.props.mapPolygons;
|
|
3997
4005
|
var newMapPolygons = mapPolygons;
|
|
@@ -4003,7 +4011,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4003
4011
|
return item.id !== editGraphicId;
|
|
4004
4012
|
});
|
|
4005
4013
|
}
|
|
4006
|
-
var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons,
|
|
4014
|
+
var _t$dataMatch3 = t.dataMatch(oldMapPolygons, newMapPolygons, "id"),
|
|
4007
4015
|
_deletedDataIDs2 = _t$dataMatch3.deletedDataIDs,
|
|
4008
4016
|
_addedData2 = _t$dataMatch3.addedData,
|
|
4009
4017
|
_updatedData2 = _t$dataMatch3.updatedData;
|
|
@@ -4019,7 +4027,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4019
4027
|
try {
|
|
4020
4028
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4021
4029
|
var _id = _step2.value;
|
|
4022
|
-
t.removeGraphic(_id,
|
|
4030
|
+
t.removeGraphic(_id, "polygon");
|
|
4023
4031
|
}
|
|
4024
4032
|
//增加
|
|
4025
4033
|
} catch (err) {
|
|
@@ -4031,10 +4039,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4031
4039
|
//更新
|
|
4032
4040
|
t.updatePolygon([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
|
|
4033
4041
|
}
|
|
4034
|
-
/*
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4042
|
+
/*
|
|
4043
|
+
圆数据处理
|
|
4044
|
+
先全删除,再新增
|
|
4045
|
+
*/
|
|
4038
4046
|
if (mapCircles instanceof Array && t.props.mapCircles instanceof Array && !t.deepEqual(mapCircles, t.props.mapCircles)) {
|
|
4039
4047
|
var oldMapCircles = t.props.mapCircles;
|
|
4040
4048
|
var newMapCircles = mapCircles;
|
|
@@ -4046,7 +4054,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4046
4054
|
return item.id !== editGraphicId;
|
|
4047
4055
|
});
|
|
4048
4056
|
}
|
|
4049
|
-
var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles,
|
|
4057
|
+
var _t$dataMatch4 = t.dataMatch(oldMapCircles, newMapCircles, "id"),
|
|
4050
4058
|
_deletedDataIDs3 = _t$dataMatch4.deletedDataIDs,
|
|
4051
4059
|
_addedData3 = _t$dataMatch4.addedData,
|
|
4052
4060
|
_updatedData3 = _t$dataMatch4.updatedData;
|
|
@@ -4062,7 +4070,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4062
4070
|
try {
|
|
4063
4071
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
4064
4072
|
var _id2 = _step3.value;
|
|
4065
|
-
t.removeGraphic(_id2,
|
|
4073
|
+
t.removeGraphic(_id2, "circle");
|
|
4066
4074
|
}
|
|
4067
4075
|
//增加
|
|
4068
4076
|
} catch (err) {
|
|
@@ -4075,7 +4083,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4075
4083
|
t.updateCircle([].concat(_toConsumableArray(_upds3), _toConsumableArray(_otherupds3)));
|
|
4076
4084
|
}
|
|
4077
4085
|
//图元编辑调用
|
|
4078
|
-
if (typeof isDoEdit ==
|
|
4086
|
+
if (typeof isDoEdit == "boolean" && isDoEdit || isDoEdit && isDoEdit !== t.props.isDoEdit) {
|
|
4079
4087
|
t.doEdit(editGraphicId);
|
|
4080
4088
|
}
|
|
4081
4089
|
// 获取热力图
|
|
@@ -4085,15 +4093,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4085
4093
|
t.clearHeatMap(heatMapData);
|
|
4086
4094
|
}
|
|
4087
4095
|
//清空地图
|
|
4088
|
-
if (typeof isClearAll ==
|
|
4096
|
+
if (typeof isClearAll == "boolean" && isClearAll || isClearAll && isClearAll !== t.props.isClearAll) {
|
|
4089
4097
|
t.clearAll();
|
|
4090
4098
|
}
|
|
4091
4099
|
//测距工具调用
|
|
4092
|
-
if (typeof isRangingTool ==
|
|
4100
|
+
if (typeof isRangingTool == "boolean" && isRangingTool || isRangingTool && isRangingTool !== t.props.isRangingTool) {
|
|
4093
4101
|
t.vtxRangingTool(mapRangingTool);
|
|
4094
4102
|
}
|
|
4095
4103
|
/*设置指定图元展示*/
|
|
4096
|
-
if (typeof setVisiblePoints ==
|
|
4104
|
+
if (typeof setVisiblePoints == "boolean" && setVisiblePoints || setVisiblePoints && setVisiblePoints !== t.props.setVisiblePoints) {
|
|
4097
4105
|
t.setVisiblePoints(mapVisiblePoints);
|
|
4098
4106
|
}
|
|
4099
4107
|
//设置中心点
|
|
@@ -4106,44 +4114,44 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4106
4114
|
t.setCenter(mapCenter);
|
|
4107
4115
|
}
|
|
4108
4116
|
//设置点聚合
|
|
4109
|
-
if (typeof setCluster ==
|
|
4117
|
+
if (typeof setCluster == "boolean" && setCluster || setCluster && setCluster !== t.props.setCluster) {
|
|
4110
4118
|
t.cluster(mapCluster);
|
|
4111
4119
|
}
|
|
4112
4120
|
if (!setCluster && setCluster !== t.props.setCluster) {
|
|
4113
4121
|
t.clearCluster(mapCluster);
|
|
4114
4122
|
}
|
|
4115
4123
|
//图元编辑调用
|
|
4116
|
-
if (typeof isDoEdit ==
|
|
4124
|
+
if (typeof isDoEdit == "boolean" && isDoEdit || isDoEdit && isDoEdit !== t.props.isDoEdit) {
|
|
4117
4125
|
t.doEdit(editGraphicId);
|
|
4118
4126
|
}
|
|
4119
4127
|
//关闭图元编辑
|
|
4120
|
-
if (typeof isEndEdit ==
|
|
4128
|
+
if (typeof isEndEdit == "boolean" && isEndEdit || isEndEdit && isEndEdit !== t.props.isEndEdit) {
|
|
4121
4129
|
t.endEdit();
|
|
4122
4130
|
}
|
|
4123
4131
|
//绘制图元
|
|
4124
|
-
if (typeof isDraw ==
|
|
4132
|
+
if (typeof isDraw == "boolean" && isDraw || isDraw && isDraw !== t.props.isDraw) {
|
|
4125
4133
|
t.draw(mapDraw);
|
|
4126
4134
|
}
|
|
4127
4135
|
//关闭绘制
|
|
4128
|
-
if (typeof isCloseDraw ==
|
|
4136
|
+
if (typeof isCloseDraw == "boolean" && isCloseDraw || isCloseDraw && isCloseDraw !== t.props.isCloseDraw) {
|
|
4129
4137
|
t.closeDraw();
|
|
4130
4138
|
}
|
|
4131
4139
|
//单独删除操作
|
|
4132
|
-
if (typeof isRemove ==
|
|
4140
|
+
if (typeof isRemove == "boolean" && isRemove || isRemove && isRemove !== t.props.isRemove) {
|
|
4133
4141
|
mapRemove.map(function (item, index) {
|
|
4134
4142
|
t.removeGraphic(item.id, item.type);
|
|
4135
4143
|
});
|
|
4136
4144
|
}
|
|
4137
4145
|
//设置区域限制
|
|
4138
|
-
if (typeof isSetAreaRestriction ==
|
|
4146
|
+
if (typeof isSetAreaRestriction == "boolean" && isSetAreaRestriction || isSetAreaRestriction && isSetAreaRestriction !== t.props.isSetAreaRestriction && areaRestriction && !!areaRestriction[0] && !!areaRestriction[1]) {
|
|
4139
4147
|
t.setAreaRestriction(areaRestriction);
|
|
4140
4148
|
}
|
|
4141
4149
|
//关闭区域限制
|
|
4142
|
-
if (typeof isClearAreaRestriction ==
|
|
4150
|
+
if (typeof isClearAreaRestriction == "boolean" && isClearAreaRestriction || isClearAreaRestriction && isClearAreaRestriction !== t.props.isClearAreaRestriction) {
|
|
4143
4151
|
t.clearAreaRestriction();
|
|
4144
4152
|
}
|
|
4145
4153
|
// 设置地图层级
|
|
4146
|
-
if (typeof setZoomLevel ==
|
|
4154
|
+
if (typeof setZoomLevel == "boolean" && setZoomLevel || setZoomLevel && setZoomLevel !== t.props.setZoomLevel) {
|
|
4147
4155
|
t.setZoomLevel(mapZoomLevel);
|
|
4148
4156
|
}
|
|
4149
4157
|
// 比例尺控件位置改变
|
|
@@ -4161,7 +4169,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4161
4169
|
key: "clickMap",
|
|
4162
4170
|
value: function clickMap(e) {
|
|
4163
4171
|
var t = this;
|
|
4164
|
-
if (typeof t.props.clickMap ===
|
|
4172
|
+
if (typeof t.props.clickMap === "function") {
|
|
4165
4173
|
var obj = t.getMapExtent();
|
|
4166
4174
|
obj.e = e;
|
|
4167
4175
|
obj.clickLngLat = {
|
|
@@ -4193,7 +4201,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4193
4201
|
var url = source.getFeatureInfoUrl(event.coordinate, view.getResolution(), view.getProjection(), {
|
|
4194
4202
|
cql_filter: sourceParam === null || sourceParam === void 0 ? void 0 : sourceParam.cql_filter,
|
|
4195
4203
|
QUERY_LAYERS: sourceParam === null || sourceParam === void 0 ? void 0 : sourceParam.layers,
|
|
4196
|
-
INFO_FORMAT:
|
|
4204
|
+
INFO_FORMAT: "application/json",
|
|
4197
4205
|
REQUEST: "GetFeatureInfo",
|
|
4198
4206
|
FEATURE_COUNT: 50
|
|
4199
4207
|
});
|
|
@@ -4222,7 +4230,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4222
4230
|
});
|
|
4223
4231
|
}
|
|
4224
4232
|
return features;
|
|
4225
|
-
})
|
|
4233
|
+
}).catch(function () {
|
|
4226
4234
|
return [];
|
|
4227
4235
|
});
|
|
4228
4236
|
}
|
|
@@ -4232,7 +4240,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4232
4240
|
value: function mouseOverGraphic(id, e) {
|
|
4233
4241
|
var t = this;
|
|
4234
4242
|
if (t.state.editId == id) return false;
|
|
4235
|
-
if (typeof t.props.mouseOverGraphic ===
|
|
4243
|
+
if (typeof t.props.mouseOverGraphic === "function") {
|
|
4236
4244
|
var obj = {
|
|
4237
4245
|
e: e,
|
|
4238
4246
|
id: id,
|
|
@@ -4251,7 +4259,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4251
4259
|
var t = this;
|
|
4252
4260
|
//编辑中的图元关闭其他事件返回
|
|
4253
4261
|
if (t.state.editId == id) return false;
|
|
4254
|
-
if (typeof t.props.mouseOutGraphic ===
|
|
4262
|
+
if (typeof t.props.mouseOutGraphic === "function") {
|
|
4255
4263
|
var obj = {
|
|
4256
4264
|
e: e,
|
|
4257
4265
|
id: id,
|
|
@@ -4268,7 +4276,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4268
4276
|
key: "dragMapStart",
|
|
4269
4277
|
value: function dragMapStart(e) {
|
|
4270
4278
|
var t = this;
|
|
4271
|
-
if (typeof t.props.dragMapStart ===
|
|
4279
|
+
if (typeof t.props.dragMapStart === "function") {
|
|
4272
4280
|
var obj = t.getMapExtent();
|
|
4273
4281
|
obj.e = e;
|
|
4274
4282
|
t.props.dragMapStart(obj);
|
|
@@ -4279,7 +4287,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4279
4287
|
key: "dragMapEnd",
|
|
4280
4288
|
value: function dragMapEnd(e) {
|
|
4281
4289
|
var t = this;
|
|
4282
|
-
if (typeof t.props.dragMapEnd ===
|
|
4290
|
+
if (typeof t.props.dragMapEnd === "function") {
|
|
4283
4291
|
var obj = t.getMapExtent();
|
|
4284
4292
|
obj.e = e;
|
|
4285
4293
|
t.props.dragMapEnd(obj);
|
|
@@ -4296,7 +4304,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4296
4304
|
max: 100,
|
|
4297
4305
|
visible: true,
|
|
4298
4306
|
opacity: 0.7,
|
|
4299
|
-
gradient: [
|
|
4307
|
+
gradient: ["#00f", "#0ff", "#0f0", "#ff0", "#f00"]
|
|
4300
4308
|
};
|
|
4301
4309
|
if (d.config) {
|
|
4302
4310
|
cg = _objectSpread(_objectSpread({}, cg), d.config);
|
|
@@ -4316,15 +4324,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4316
4324
|
// })
|
|
4317
4325
|
// }
|
|
4318
4326
|
var heatData = {
|
|
4319
|
-
type:
|
|
4327
|
+
type: "FeatureCollection",
|
|
4320
4328
|
features: (d.data || []).map(function (item) {
|
|
4321
4329
|
return {
|
|
4322
|
-
type:
|
|
4330
|
+
type: "Feature",
|
|
4323
4331
|
properties: {
|
|
4324
4332
|
weight: item.count ? item.count / 100 : 0.5
|
|
4325
4333
|
},
|
|
4326
4334
|
geometry: {
|
|
4327
|
-
type:
|
|
4335
|
+
type: "Point",
|
|
4328
4336
|
coordinates: [item.lng, item.lat]
|
|
4329
4337
|
}
|
|
4330
4338
|
};
|
|
@@ -4334,7 +4342,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4334
4342
|
features: new ol.format.GeoJSON().readFeatures(heatData)
|
|
4335
4343
|
});
|
|
4336
4344
|
t.heatmap = new ol.layer.Heatmap({
|
|
4337
|
-
name:
|
|
4345
|
+
name: "heatmap",
|
|
4338
4346
|
source: heatSource,
|
|
4339
4347
|
radius: cg.radius,
|
|
4340
4348
|
visible: cg.visible,
|
|
@@ -4359,7 +4367,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4359
4367
|
key: "moveStart",
|
|
4360
4368
|
value: function moveStart(e) {
|
|
4361
4369
|
var t = this;
|
|
4362
|
-
if (typeof t.props.moveStart ===
|
|
4370
|
+
if (typeof t.props.moveStart === "function") {
|
|
4363
4371
|
var obj = t.getMapExtent();
|
|
4364
4372
|
obj.e = e;
|
|
4365
4373
|
t.props.moveStart(obj);
|
|
@@ -4370,7 +4378,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4370
4378
|
key: "moveEnd",
|
|
4371
4379
|
value: function moveEnd(e) {
|
|
4372
4380
|
var t = this;
|
|
4373
|
-
if (typeof t.props.moveEnd ===
|
|
4381
|
+
if (typeof t.props.moveEnd === "function") {
|
|
4374
4382
|
var obj = t.getMapExtent();
|
|
4375
4383
|
obj.e = e;
|
|
4376
4384
|
t.props.moveEnd(obj);
|
|
@@ -4381,7 +4389,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4381
4389
|
key: "zoomStart",
|
|
4382
4390
|
value: function zoomStart(e) {
|
|
4383
4391
|
var t = this;
|
|
4384
|
-
if (typeof t.props.zoomStart ===
|
|
4392
|
+
if (typeof t.props.zoomStart === "function") {
|
|
4385
4393
|
var obj = t.getMapExtent();
|
|
4386
4394
|
obj.e = e;
|
|
4387
4395
|
t.props.zoomStart(obj);
|
|
@@ -4392,7 +4400,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4392
4400
|
key: "zoomEnd",
|
|
4393
4401
|
value: function zoomEnd(e) {
|
|
4394
4402
|
var t = this;
|
|
4395
|
-
if (typeof t.props.zoomEnd ===
|
|
4403
|
+
if (typeof t.props.zoomEnd === "function") {
|
|
4396
4404
|
var obj = t.getMapExtent();
|
|
4397
4405
|
obj.e = e;
|
|
4398
4406
|
t.props.zoomEnd(obj);
|
|
@@ -4406,7 +4414,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4406
4414
|
var t = this;
|
|
4407
4415
|
//编辑中的图元关闭其他事件返回
|
|
4408
4416
|
if (t.editId == id) return false;
|
|
4409
|
-
if (typeof t.props.clickGraphic ===
|
|
4417
|
+
if (typeof t.props.clickGraphic === "function") {
|
|
4410
4418
|
var _e$pixel = _slicedToArray(e.pixel, 2),
|
|
4411
4419
|
clientX = _e$pixel[0],
|
|
4412
4420
|
clientY = _e$pixel[1];
|
|
@@ -4452,35 +4460,37 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4452
4460
|
window.VtxMap && (window.VtxMap[t.state.mapId] = null);
|
|
4453
4461
|
}
|
|
4454
4462
|
}]);
|
|
4455
|
-
|
|
4456
|
-
|
|
4463
|
+
return OlMap;
|
|
4464
|
+
}(_react.default.Component);
|
|
4465
|
+
var _default = exports.default = OlMap;
|
|
4457
4466
|
var Popup = /*#__PURE__*/function (_React$Component2) {
|
|
4467
|
+
_inherits(Popup, _React$Component2);
|
|
4468
|
+
var _super2 = _createSuper(Popup);
|
|
4458
4469
|
function Popup(props) {
|
|
4459
|
-
var
|
|
4470
|
+
var _this10;
|
|
4460
4471
|
_classCallCheck(this, Popup);
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
return
|
|
4472
|
+
_this10 = _super2.call(this);
|
|
4473
|
+
_this10.map = props.map;
|
|
4474
|
+
_this10.position = props.position;
|
|
4475
|
+
_this10.overlay = null;
|
|
4476
|
+
_this10.container = null;
|
|
4477
|
+
_this10.innerHTML = props.innerHTML;
|
|
4478
|
+
_this10.closeble = props.close;
|
|
4479
|
+
return _this10;
|
|
4469
4480
|
}
|
|
4470
4481
|
|
|
4471
4482
|
// 弹出框
|
|
4472
|
-
|
|
4473
|
-
return _createClass(Popup, [{
|
|
4483
|
+
_createClass(Popup, [{
|
|
4474
4484
|
key: "showPopup",
|
|
4475
4485
|
value: function showPopup() {
|
|
4476
4486
|
var t = this;
|
|
4477
4487
|
this.removePopup();
|
|
4478
4488
|
// 获取弹出层DOM
|
|
4479
4489
|
t.container = document.createElement("div");
|
|
4480
|
-
t.container[
|
|
4490
|
+
t.container["className"] = "ol-popup";
|
|
4481
4491
|
if (t.closeble) {
|
|
4482
4492
|
var close = document.createElement("a");
|
|
4483
|
-
close[
|
|
4493
|
+
close["className"] = "ol-popup-closer";
|
|
4484
4494
|
close.addEventListener("click", function (e) {
|
|
4485
4495
|
t.removePopup();
|
|
4486
4496
|
});
|
|
@@ -4518,16 +4528,17 @@ var Popup = /*#__PURE__*/function (_React$Component2) {
|
|
|
4518
4528
|
}
|
|
4519
4529
|
}
|
|
4520
4530
|
}]);
|
|
4521
|
-
|
|
4531
|
+
return Popup;
|
|
4532
|
+
}(_react.default.Component);
|
|
4522
4533
|
function getRgbColor(color, opacity) {
|
|
4523
4534
|
var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
|
|
4524
|
-
if (!reg.test(color) && typeof color !==
|
|
4535
|
+
if (!reg.test(color) && typeof color !== "string") {
|
|
4525
4536
|
return;
|
|
4526
4537
|
}
|
|
4527
|
-
var newStr = color.toLowerCase().replace(/\#/g,
|
|
4538
|
+
var newStr = color.toLowerCase().replace(/\#/g, "");
|
|
4528
4539
|
var len = newStr.length;
|
|
4529
4540
|
if (len == 3) {
|
|
4530
|
-
var t =
|
|
4541
|
+
var t = "";
|
|
4531
4542
|
for (var i = 0; i < len; i++) {
|
|
4532
4543
|
t += newStr.slice(i, i + 1).concat(newStr.slice(i, i + 1));
|
|
4533
4544
|
}
|
|
@@ -4536,16 +4547,16 @@ function getRgbColor(color, opacity) {
|
|
|
4536
4547
|
var arr = []; //将字符串分隔,两个两个的分隔
|
|
4537
4548
|
for (var i = 0; i < 6; i = i + 2) {
|
|
4538
4549
|
var s = newStr.slice(i, i + 2);
|
|
4539
|
-
arr.push(parseInt(
|
|
4550
|
+
arr.push(parseInt("0x" + s));
|
|
4540
4551
|
}
|
|
4541
|
-
return
|
|
4552
|
+
return "rgba(" + arr.join(",") + "," + opacity + ")";
|
|
4542
4553
|
}
|
|
4543
4554
|
|
|
4544
4555
|
// 压缩图片的方法
|
|
4545
4556
|
function canvasDataURL(path, obj, callback) {
|
|
4546
4557
|
var img = new Image();
|
|
4547
4558
|
img.src = path;
|
|
4548
|
-
img.setAttribute("crossOrigin",
|
|
4559
|
+
img.setAttribute("crossOrigin", "Anonymous");
|
|
4549
4560
|
img.onload = function () {
|
|
4550
4561
|
var that = this;
|
|
4551
4562
|
// 默认按比例压缩
|
|
@@ -4556,8 +4567,8 @@ function canvasDataURL(path, obj, callback) {
|
|
|
4556
4567
|
h = obj.height || w / scale;
|
|
4557
4568
|
var quality = 0.7; // 默认图片质量为0.7
|
|
4558
4569
|
//生成canvas
|
|
4559
|
-
var canvas = document.createElement(
|
|
4560
|
-
var ctx = canvas.getContext(
|
|
4570
|
+
var canvas = document.createElement("canvas");
|
|
4571
|
+
var ctx = canvas.getContext("2d");
|
|
4561
4572
|
// 创建属性节点
|
|
4562
4573
|
var anw = document.createAttribute("width");
|
|
4563
4574
|
anw.nodeValue = w;
|
|
@@ -4571,7 +4582,7 @@ function canvasDataURL(path, obj, callback) {
|
|
|
4571
4582
|
quality = obj.quality;
|
|
4572
4583
|
}
|
|
4573
4584
|
// quality值越小,所绘制出的图像越模糊
|
|
4574
|
-
var base64 = canvas.toDataURL(
|
|
4585
|
+
var base64 = canvas.toDataURL("image/png", quality);
|
|
4575
4586
|
// 回调函数返回base64的值
|
|
4576
4587
|
callback(base64);
|
|
4577
4588
|
};
|
|
@@ -4581,7 +4592,7 @@ var ImgCache = /*#__PURE__*/function () {
|
|
|
4581
4592
|
_classCallCheck(this, ImgCache);
|
|
4582
4593
|
this.imgs = {};
|
|
4583
4594
|
}
|
|
4584
|
-
|
|
4595
|
+
_createClass(ImgCache, [{
|
|
4585
4596
|
key: "set",
|
|
4586
4597
|
value: function set(key, value) {
|
|
4587
4598
|
this.imgs[key] = value;
|
|
@@ -4604,6 +4615,5 @@ var ImgCache = /*#__PURE__*/function () {
|
|
|
4604
4615
|
this.imgs = {};
|
|
4605
4616
|
}
|
|
4606
4617
|
}]);
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
//# sourceMappingURL=Map.js.map
|
|
4618
|
+
return ImgCache;
|
|
4619
|
+
}();
|