@vtx/map 1.1.18 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.css +171 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js +1182 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.js.map +1 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMap.less +171 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMapAntd3.css +0 -0
- package/lib/VtxSearchCheckMap/VtxSearchCheckMapAntd3.less +1 -0
- package/lib/VtxSearchCheckMap/index.js +22 -0
- package/lib/VtxSearchCheckMap/index.js.map +1 -0
- package/lib/VtxSearchCheckMap/mapping.js +18 -0
- package/lib/VtxSearchCheckMap/mapping.js.map +1 -0
- package/lib/VtxSearchCheckMap/style/css.js +47 -0
- package/lib/VtxSearchCheckMap/style/css.js.map +1 -0
- package/lib/VtxSearchCheckMap/style/index.js +47 -0
- package/lib/VtxSearchCheckMap/style/index.js.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
13
|
+
|
|
14
|
+
var _input = _interopRequireDefault(require("antd/lib/input"));
|
|
15
|
+
|
|
16
|
+
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
17
|
+
|
|
18
|
+
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
|
|
19
|
+
|
|
20
|
+
var _radio = _interopRequireDefault(require("antd/lib/radio"));
|
|
21
|
+
|
|
22
|
+
var _VtxModal = require("../VtxModal");
|
|
23
|
+
|
|
24
|
+
var _VtxMap = require("../VtxMap");
|
|
25
|
+
|
|
26
|
+
var _default2 = _interopRequireWildcard(require("../default"));
|
|
27
|
+
|
|
28
|
+
var _mapping = require("./mapping");
|
|
29
|
+
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
+
|
|
36
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
37
|
+
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
|
+
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
|
+
|
|
42
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
43
|
+
|
|
44
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
45
|
+
|
|
46
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
47
|
+
|
|
48
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
49
|
+
|
|
50
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
51
|
+
|
|
52
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
53
|
+
|
|
54
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
55
|
+
|
|
56
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
57
|
+
|
|
58
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
|
+
|
|
60
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
61
|
+
|
|
62
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
63
|
+
|
|
64
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
65
|
+
|
|
66
|
+
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."); }
|
|
67
|
+
|
|
68
|
+
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); }
|
|
69
|
+
|
|
70
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
71
|
+
|
|
72
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
73
|
+
|
|
74
|
+
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; }
|
|
75
|
+
|
|
76
|
+
var styles = {
|
|
77
|
+
searchModal: "vtx-ui-searchmap-searchmodal",
|
|
78
|
+
searchMap: "vtx-ui-searchmap-searchmap",
|
|
79
|
+
top: "vtx-ui-searchmap-top",
|
|
80
|
+
bottom: "vtx-ui-searchmap-bottom",
|
|
81
|
+
content: "vtx-ui-searchmap-content",
|
|
82
|
+
show: "vtx-ui-searchmap-show",
|
|
83
|
+
hidden: "vtx-ui-searchmap-hidden",
|
|
84
|
+
w_l: "vtx-ui-searchmap-w_l",
|
|
85
|
+
content_left: "vtx-ui-searchmap-content_left",
|
|
86
|
+
listTitle: "vtx-ui-searchmap-listtitle",
|
|
87
|
+
title: "vtx-ui-searchmap-title",
|
|
88
|
+
btn: "vtx-ui-searchmap-btn",
|
|
89
|
+
lists: "vtx-ui-searchmap-lists",
|
|
90
|
+
select: "vtx-ui-searchmap-select",
|
|
91
|
+
scrollauto: "vtx-ui-searchmap-scrollauto",
|
|
92
|
+
content_right: "vtx-ui-searchmap-content_right",
|
|
93
|
+
showLabel: "vtx-ui-searchmap-showlabel",
|
|
94
|
+
hiddenLabel: "vtx-ui-searchmap-hiddenlabel",
|
|
95
|
+
otherModal: "vtx-ui-searchmap-othermodal"
|
|
96
|
+
}; // message.config({
|
|
97
|
+
// top: document.getElementById('root').offsetHeight/3,
|
|
98
|
+
// duration: 5,
|
|
99
|
+
// });
|
|
100
|
+
|
|
101
|
+
var warning = function warning() {
|
|
102
|
+
_message["default"].warning("位置点查询失败,请缩小比例尺或切换关键字后再重新查询!");
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
function distinct(ary) {
|
|
106
|
+
var pts = _toConsumableArray(ary);
|
|
107
|
+
|
|
108
|
+
if (pts[0][0] == pts[pts.length - 1][0] && pts[0][1] == pts[pts.length - 1][1]) {
|
|
109
|
+
pts.pop();
|
|
110
|
+
return distinct(pts);
|
|
111
|
+
} else {
|
|
112
|
+
return pts;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var getIcon = function getIcon(type) {
|
|
117
|
+
return _default2.antdMajorVersion === "4" ? /*#__PURE__*/_react["default"].createElement(_default2.VtxMapIcon, {
|
|
118
|
+
type: "icon-".concat(_mapping.iconMapping[type])
|
|
119
|
+
}) : type;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
var VtxSearchCheckMap = /*#__PURE__*/function (_React$Component) {
|
|
123
|
+
_inherits(VtxSearchCheckMap, _React$Component);
|
|
124
|
+
|
|
125
|
+
var _super = _createSuper(VtxSearchCheckMap);
|
|
126
|
+
|
|
127
|
+
function VtxSearchCheckMap(props) {
|
|
128
|
+
var _this;
|
|
129
|
+
|
|
130
|
+
_classCallCheck(this, VtxSearchCheckMap);
|
|
131
|
+
|
|
132
|
+
_this = _super.call(this, props);
|
|
133
|
+
|
|
134
|
+
_defineProperty(_assertThisInitialized(_this), "getMultiRes", function (graphicType) {
|
|
135
|
+
var resData = [];
|
|
136
|
+
var _this$state = _this.state,
|
|
137
|
+
graphicValue = _this$state.graphicValue,
|
|
138
|
+
editGraphic = _this$state.editGraphic;
|
|
139
|
+
|
|
140
|
+
switch (graphicType) {
|
|
141
|
+
case "polygon":
|
|
142
|
+
[].concat(_toConsumableArray(graphicValue || []), _toConsumableArray(editGraphic || [])).forEach(function (item) {
|
|
143
|
+
resData.push({
|
|
144
|
+
rings: distinct(item.rings || item.geometry.rings),
|
|
145
|
+
area: _this.map.getPolygonArea(distinct(item.rings || item.geometry.rings))
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
default:
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return resData.length ? resData : null;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
_this.map = null; //Map组件的ref对象
|
|
158
|
+
|
|
159
|
+
_this.mapLoaded = false;
|
|
160
|
+
_this.isDrawStatus = false;
|
|
161
|
+
_this.isClickMap = false;
|
|
162
|
+
_this.apid = []; //所有点id,除编辑点外
|
|
163
|
+
|
|
164
|
+
_this.loadExtent = null;
|
|
165
|
+
_this.mapId = "searchMap".concat(new Date().getTime());
|
|
166
|
+
_this.multiDraw = props.multiDraw && ["polygon"].includes(props.graphicType);
|
|
167
|
+
_this.clickable = false, // 多个面绘制时,是否可以点击面进行编辑
|
|
168
|
+
_this.state = {
|
|
169
|
+
//列表和地图宽度切换的动画需要
|
|
170
|
+
isShowList: false,
|
|
171
|
+
//可拖动用于定位的点
|
|
172
|
+
locationPoint: [],
|
|
173
|
+
//搜索框文字
|
|
174
|
+
searchValue: "",
|
|
175
|
+
//搜索出来的列表点位
|
|
176
|
+
listPoint: [],
|
|
177
|
+
//列表数据
|
|
178
|
+
listMess: [],
|
|
179
|
+
// 返回点位/图形
|
|
180
|
+
graphicType: props.graphicType || "point",
|
|
181
|
+
isDraw: props.graphicType !== "point",
|
|
182
|
+
parameter: props.drawParameter,
|
|
183
|
+
graphicValue: _this.multiDraw ? [] : null,
|
|
184
|
+
// 绘制图元id集合
|
|
185
|
+
drawGraphID: _this.multiDraw ? ["drawnGraph"] : "drawnGraph",
|
|
186
|
+
|
|
187
|
+
/*地图Api参数*/
|
|
188
|
+
mapCenter: props.mapCenter || "",
|
|
189
|
+
maxZoom: props.maxZoom,
|
|
190
|
+
minZoom: props.minZoom,
|
|
191
|
+
wkid: props.wkid,
|
|
192
|
+
mapType: props.mapType || "bmap",
|
|
193
|
+
mapStyle: props.mapStyle,
|
|
194
|
+
mapServer: props.mapServer,
|
|
195
|
+
setCenter: false,
|
|
196
|
+
mapVisiblePoints: {
|
|
197
|
+
fitView: [],
|
|
198
|
+
type: "all"
|
|
199
|
+
},
|
|
200
|
+
setVisiblePoints: false,
|
|
201
|
+
isDoEdit: false,
|
|
202
|
+
isEndEdit: false,
|
|
203
|
+
editGraphicId: "",
|
|
204
|
+
editGraphic: _this.multiDraw ? [] : null,
|
|
205
|
+
mapZoomLevel: props.mapZoomLevel || 11,
|
|
206
|
+
setZoomLevel: false,
|
|
207
|
+
|
|
208
|
+
/*modal参数*/
|
|
209
|
+
modal1Visible: props.modal1Visible || false,
|
|
210
|
+
isShowOther: props.isShowOther || false,
|
|
211
|
+
otherText: props.otherText || "显示服务区域",
|
|
212
|
+
isShowOtherGraph: props.isShowOther || false,
|
|
213
|
+
// openlayer
|
|
214
|
+
olProps: props.olProps,
|
|
215
|
+
// 坐标反查
|
|
216
|
+
checkValue: false
|
|
217
|
+
};
|
|
218
|
+
return _this;
|
|
219
|
+
} // 绘制多个图元时返回参数
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
_createClass(VtxSearchCheckMap, [{
|
|
223
|
+
key: "callback",
|
|
224
|
+
value: //经纬度回调
|
|
225
|
+
function callback() {
|
|
226
|
+
var fun = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "callback";
|
|
227
|
+
|
|
228
|
+
if (fun in this.props && typeof this.props[fun] === "function") {
|
|
229
|
+
var editGraphicId = this.state.editGraphicId;
|
|
230
|
+
|
|
231
|
+
switch (this.state.graphicType) {
|
|
232
|
+
case "point":
|
|
233
|
+
var locationPoint = this.state.locationPoint;
|
|
234
|
+
|
|
235
|
+
if (this.map.getGraphic("locationPoint")) {
|
|
236
|
+
var p = this.map.getGraphic(locationPoint[0].id).geometry;
|
|
237
|
+
this.props[fun]([p.x, p.y]);
|
|
238
|
+
} else {
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
break;
|
|
243
|
+
|
|
244
|
+
case "circle":
|
|
245
|
+
this.props[fun](this.state.graphicValue ? {
|
|
246
|
+
x: this.state.graphicValue.geometry.x,
|
|
247
|
+
y: this.state.graphicValue.geometry.y,
|
|
248
|
+
radius: this.state.graphicValue.geometry.radius,
|
|
249
|
+
area: this.state.graphicValue.area
|
|
250
|
+
} : null);
|
|
251
|
+
break;
|
|
252
|
+
|
|
253
|
+
case "polygon":
|
|
254
|
+
if (this.multiDraw) {
|
|
255
|
+
this.props[fun](this.getMultiRes("polygon"));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (this.map.getGraphic(editGraphicId)) {
|
|
260
|
+
var _p = this.map.getGraphic(editGraphicId);
|
|
261
|
+
|
|
262
|
+
this.props[fun]({
|
|
263
|
+
rings: distinct(_p.geometry.rings),
|
|
264
|
+
area: this.map.getPolygonArea(distinct(_p.geometry.rings))
|
|
265
|
+
});
|
|
266
|
+
} else {
|
|
267
|
+
this.props[fun](this.state.graphicValue ? {
|
|
268
|
+
rings: distinct(this.state.graphicValue.geometry.rings),
|
|
269
|
+
area: this.state.graphicValue.area
|
|
270
|
+
} : null);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
break;
|
|
274
|
+
|
|
275
|
+
case "rectangle":
|
|
276
|
+
this.props[fun](this.state.graphicValue ? {
|
|
277
|
+
rings: distinct(this.state.graphicValue.geometry.rings),
|
|
278
|
+
area: this.state.graphicValue.area
|
|
279
|
+
} : null);
|
|
280
|
+
break;
|
|
281
|
+
|
|
282
|
+
case "polyline":
|
|
283
|
+
if (this.map.getGraphic(editGraphicId)) {
|
|
284
|
+
var _p2 = this.map.getGraphic(editGraphicId);
|
|
285
|
+
|
|
286
|
+
this.props[fun]({
|
|
287
|
+
paths: _p2.geometry.paths,
|
|
288
|
+
length: this.map.calculateDistance(_p2.geometry.paths)
|
|
289
|
+
});
|
|
290
|
+
} else {
|
|
291
|
+
this.props[fun](this.state.graphicValue ? {
|
|
292
|
+
paths: this.state.graphicValue.geometry.paths,
|
|
293
|
+
length: this.map.calculateDistance(this.state.graphicValue.geometry.paths)
|
|
294
|
+
} : null);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (this.props.clearDrawnGraph) {
|
|
302
|
+
this.clearDrawnGraph();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
key: "showOrhidden",
|
|
307
|
+
value: function showOrhidden(bealoon) {
|
|
308
|
+
this.setState({
|
|
309
|
+
isShowList: bealoon
|
|
310
|
+
});
|
|
311
|
+
} //绘制定位点(以当前的中心点位参照 => 同时开启点位编辑)
|
|
312
|
+
|
|
313
|
+
}, {
|
|
314
|
+
key: "drawLocationPoint",
|
|
315
|
+
value: function drawLocationPoint() {
|
|
316
|
+
var t = this; //判断arcgis,是: 判断中心点是否已经确定,确定,继续走逻辑.不确认.轮询等待
|
|
317
|
+
|
|
318
|
+
if (this.props.mapType !== "gmap" || this.map.state.gis.extent && !!this.map.state.gis.extent.xmax) {
|
|
319
|
+
var lglt = this.map.getMapExtent(),
|
|
320
|
+
editGraphic = null,
|
|
321
|
+
editGraphicId = "locationPoint";
|
|
322
|
+
|
|
323
|
+
if (!this.multiDraw && this.props.editParam) {
|
|
324
|
+
// && (this.props.graphicType == 'polyline' || this.props.graphicType == 'polygon')
|
|
325
|
+
editGraphic = _objectSpread(_objectSpread({}, this.props.editParam), {}, {
|
|
326
|
+
id: "drawnGraph"
|
|
327
|
+
});
|
|
328
|
+
editGraphicId = "drawnGraph";
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (this.multiDraw && Array.isArray(this.props.editParam) && this.props.editParam.length) {
|
|
332
|
+
// && (this.props.graphicType == 'polyline' || this.props.graphicType == 'polygon')
|
|
333
|
+
editGraphic = this.props.editParam.map(function (item, index) {
|
|
334
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
335
|
+
id: "drawnGraph".concat(index)
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
editGraphicId = null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
this.isinit = false;
|
|
342
|
+
this.setState({
|
|
343
|
+
editGraphic: editGraphic,
|
|
344
|
+
locationPoint: [{
|
|
345
|
+
id: "locationPoint",
|
|
346
|
+
longitude: (t.props.mapCenter || [])[0] || lglt.nowCenter.lng,
|
|
347
|
+
latitude: (t.props.mapCenter || [])[1] || lglt.nowCenter.lat,
|
|
348
|
+
// url: `${configUrl.mapServerURL}/images/defaultMarker.png`,
|
|
349
|
+
url: require("../VtxMap/images/defaultMarker.png"),
|
|
350
|
+
config: {
|
|
351
|
+
zIndex: 1000
|
|
352
|
+
}
|
|
353
|
+
}]
|
|
354
|
+
}, function () {
|
|
355
|
+
t.setState({
|
|
356
|
+
isDoEdit: true,
|
|
357
|
+
editGraphicId: editGraphicId
|
|
358
|
+
}, function () {
|
|
359
|
+
setTimeout(function () {
|
|
360
|
+
t.setState({
|
|
361
|
+
isDoEdit: false
|
|
362
|
+
});
|
|
363
|
+
}, 500);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
} else {
|
|
367
|
+
t.loadExtent = setTimeout(function () {
|
|
368
|
+
t.drawLocationPoint();
|
|
369
|
+
}, 50);
|
|
370
|
+
}
|
|
371
|
+
} //校正定位的点位位置到当前的中心点
|
|
372
|
+
|
|
373
|
+
}, {
|
|
374
|
+
key: "correction",
|
|
375
|
+
value: function correction() {
|
|
376
|
+
var t = this; //获取当前中心点经纬度
|
|
377
|
+
|
|
378
|
+
var lglt = this.map.getMapExtent();
|
|
379
|
+
var _t$state = t.state,
|
|
380
|
+
locationPoint = _t$state.locationPoint,
|
|
381
|
+
checkValue = _t$state.checkValue;
|
|
382
|
+
locationPoint = locationPoint.map(function (item, index) {
|
|
383
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
384
|
+
longitude: lglt.nowCenter.lng,
|
|
385
|
+
latitude: lglt.nowCenter.lat
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
this.map.updatePoint(locationPoint); // 若坐标反查选中,校正是需要更新输入框中的经纬度
|
|
389
|
+
|
|
390
|
+
if (checkValue) this.setState({
|
|
391
|
+
searchValue: "".concat(lglt.nowCenter.lng, ",").concat(lglt.nowCenter.lat)
|
|
392
|
+
});
|
|
393
|
+
} //搜索关键字切换
|
|
394
|
+
|
|
395
|
+
}, {
|
|
396
|
+
key: "changeValue",
|
|
397
|
+
value: function changeValue(e) {
|
|
398
|
+
this.setState({
|
|
399
|
+
searchValue: e.target.value
|
|
400
|
+
});
|
|
401
|
+
} //根据关键字搜索数据
|
|
402
|
+
|
|
403
|
+
}, {
|
|
404
|
+
key: "searchList",
|
|
405
|
+
value: function searchList() {
|
|
406
|
+
//因为antd组件问题,这边使用手动关键位,控制方法执行
|
|
407
|
+
var t = this;
|
|
408
|
+
|
|
409
|
+
if (!this.state.checkValue) {
|
|
410
|
+
// 非点位并且点位非坐标反查时
|
|
411
|
+
var searchPoints = t.map.searchPoints(this.state.searchValue);
|
|
412
|
+
searchPoints.then(function (results) {
|
|
413
|
+
if (results.length > 0) {
|
|
414
|
+
var lsp = [],
|
|
415
|
+
lsm = [];
|
|
416
|
+
t.apid = [];
|
|
417
|
+
|
|
418
|
+
for (var i = 0; i < results.length; i++) {
|
|
419
|
+
var r = results[i];
|
|
420
|
+
lsp.push(_objectSpread(_objectSpread({}, results[i]), {}, {
|
|
421
|
+
// url: `${configUrl.mapServerURL}/images/defaultMarker_selected.png`,
|
|
422
|
+
url: require("../VtxMap/images/defaultMarker_selected.png"),
|
|
423
|
+
labelClass: styles.hiddenLabel
|
|
424
|
+
}));
|
|
425
|
+
lsm.push({
|
|
426
|
+
id: r.id,
|
|
427
|
+
title: r.config.labelContent,
|
|
428
|
+
isSelect: false
|
|
429
|
+
});
|
|
430
|
+
t.apid.push(r.id);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
t.setState({
|
|
434
|
+
listPoint: lsp,
|
|
435
|
+
listMess: lsm,
|
|
436
|
+
isShowList: true
|
|
437
|
+
});
|
|
438
|
+
t.setFitView();
|
|
439
|
+
} else {
|
|
440
|
+
warning();
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
} else {
|
|
444
|
+
var _this$state$searchVal;
|
|
445
|
+
|
|
446
|
+
// 点位弹框并坐标反查情况
|
|
447
|
+
var lnglats = (_this$state$searchVal = this.state.searchValue) === null || _this$state$searchVal === void 0 ? void 0 : _this$state$searchVal.split(","); // 英文逗号分割,若长度为不为2,表示数据格式错误
|
|
448
|
+
|
|
449
|
+
if ((lnglats === null || lnglats === void 0 ? void 0 : lnglats.length) !== 2) {
|
|
450
|
+
_message["default"].warning("请按正确的经纬度格式输入,经度在前,用英文逗号隔开!");
|
|
451
|
+
|
|
452
|
+
return;
|
|
453
|
+
} // 经纬度分别正则校验
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
if (!new RegExp(/^[\-\+]?(0(\.\d{1,15})?|([1-9](\d)?)(\.\d{1,15})?|1[0-7]\d{1}(\.\d{1,15})?|180\.0{1,15})$/).test(lnglats[0])) {
|
|
457
|
+
_message["default"].warning("请输入正确格式经度!");
|
|
458
|
+
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (!new RegExp(/^[\-\+]?((0|([1-8]\d?))(\.\d{1,15})?|90(\.0{1,15})?)$/).test(lnglats[1])) {
|
|
463
|
+
_message["default"].warning("请输入正确格式纬度!");
|
|
464
|
+
|
|
465
|
+
return;
|
|
466
|
+
} // 正确的经纬度作为地图中心点
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
var centerPoint = [{
|
|
470
|
+
id: "locationPoint",
|
|
471
|
+
longitude: lnglats[0],
|
|
472
|
+
latitude: lnglats[1],
|
|
473
|
+
url: require("../VtxMap/images/defaultMarker.png"),
|
|
474
|
+
config: {
|
|
475
|
+
zIndex: 1000
|
|
476
|
+
}
|
|
477
|
+
}];
|
|
478
|
+
t.setState({
|
|
479
|
+
setCenter: true,
|
|
480
|
+
mapCenter: lnglats,
|
|
481
|
+
locationPoint: centerPoint
|
|
482
|
+
});
|
|
483
|
+
this.map.updatePoint(centerPoint);
|
|
484
|
+
}
|
|
485
|
+
} //返回最佳位置(zoom,center)
|
|
486
|
+
|
|
487
|
+
}, {
|
|
488
|
+
key: "setFitView",
|
|
489
|
+
value: function setFitView() {
|
|
490
|
+
var _this2 = this;
|
|
491
|
+
|
|
492
|
+
this.setState({
|
|
493
|
+
mapVisiblePoints: {
|
|
494
|
+
fitView: this.apid,
|
|
495
|
+
type: "all"
|
|
496
|
+
},
|
|
497
|
+
setVisiblePoints: true
|
|
498
|
+
}, function () {
|
|
499
|
+
_this2.setState({
|
|
500
|
+
setVisiblePoints: false
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
} //清空列表的所有数据(包括点位)
|
|
504
|
+
|
|
505
|
+
}, {
|
|
506
|
+
key: "clearList",
|
|
507
|
+
value: function clearList() {
|
|
508
|
+
this.apid = [];
|
|
509
|
+
this.setState({
|
|
510
|
+
searchValue: "",
|
|
511
|
+
listPoint: [],
|
|
512
|
+
listMess: [],
|
|
513
|
+
isShowList: false
|
|
514
|
+
});
|
|
515
|
+
} //列表选中地址
|
|
516
|
+
|
|
517
|
+
}, {
|
|
518
|
+
key: "chooseAddress",
|
|
519
|
+
value: function chooseAddress(id) {
|
|
520
|
+
var t = this;
|
|
521
|
+
var _this$state2 = this.state,
|
|
522
|
+
listPoint = _this$state2.listPoint,
|
|
523
|
+
listMess = _this$state2.listMess;
|
|
524
|
+
var mapCenter = [];
|
|
525
|
+
listPoint = listPoint.map(function (item, index) {
|
|
526
|
+
if (item.id === id) {
|
|
527
|
+
mapCenter = [item.longitude, item.latitude];
|
|
528
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
529
|
+
url: require("../VtxMap/images/defaultMarker.png"),
|
|
530
|
+
labelClass: styles.showLabel
|
|
531
|
+
});
|
|
532
|
+
} else {
|
|
533
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
534
|
+
url: require("../VtxMap/images/defaultMarker_selected.png"),
|
|
535
|
+
labelClass: styles.hiddenLabel
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
listMess = listMess.map(function (item, index) {
|
|
540
|
+
if (item.id === id) {
|
|
541
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
542
|
+
isSelect: true
|
|
543
|
+
});
|
|
544
|
+
} else {
|
|
545
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
546
|
+
isSelect: false
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
this.setState({
|
|
551
|
+
listPoint: listPoint,
|
|
552
|
+
listMess: listMess,
|
|
553
|
+
mapCenter: mapCenter,
|
|
554
|
+
setCenter: true
|
|
555
|
+
}, function () {
|
|
556
|
+
t.setState({
|
|
557
|
+
setCenter: false
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
if (t.state.graphicType == "point") {
|
|
561
|
+
t.correction();
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
}, {
|
|
566
|
+
key: "clickGraphic",
|
|
567
|
+
value: function clickGraphic(obj) {
|
|
568
|
+
var _this3 = this;
|
|
569
|
+
|
|
570
|
+
if (obj.type === "point" && obj.attributes.other === "search") {
|
|
571
|
+
this.chooseAddress(obj.attributes.id);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (this.clickable && obj.type === "polygon") {
|
|
575
|
+
var _obj$param$attributes;
|
|
576
|
+
|
|
577
|
+
// 开启编辑
|
|
578
|
+
this.setState({
|
|
579
|
+
editGraphicId: obj.param.id || ((_obj$param$attributes = obj.param.attributes) === null || _obj$param$attributes === void 0 ? void 0 : _obj$param$attributes.id),
|
|
580
|
+
isDoEdit: false
|
|
581
|
+
}, function () {
|
|
582
|
+
_this3.setState({
|
|
583
|
+
isDoEdit: true
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}, {
|
|
589
|
+
key: "closeModal",
|
|
590
|
+
value: function closeModal(e) {
|
|
591
|
+
if (this.isDrawStatus && this.isClickMap) {
|
|
592
|
+
_message["default"].warning("请双击结束图元编辑");
|
|
593
|
+
} else {
|
|
594
|
+
if ("closeModal" in this.props) {
|
|
595
|
+
this.props.closeModal();
|
|
596
|
+
} else {
|
|
597
|
+
this.setState({
|
|
598
|
+
modal1Visible: false
|
|
599
|
+
});
|
|
600
|
+
} // if(this.props.clearDrawnGraph){
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
this.clearDrawnGraph(); // }
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}, {
|
|
607
|
+
key: "clearDrawnGraph",
|
|
608
|
+
value: function clearDrawnGraph() {
|
|
609
|
+
var _this4 = this;
|
|
610
|
+
|
|
611
|
+
this.isDrawStatus = true;
|
|
612
|
+
this.setState({
|
|
613
|
+
isDraw: this.state.graphicType !== "point",
|
|
614
|
+
graphicValue: this.multiDraw ? [] : null,
|
|
615
|
+
isEndEdit: this.state.graphicType !== "point"
|
|
616
|
+
}, function () {
|
|
617
|
+
_this4.setState({
|
|
618
|
+
isEndEdit: false
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
}, {
|
|
623
|
+
key: "continueDraw",
|
|
624
|
+
value: function continueDraw() {
|
|
625
|
+
var _this5 = this;
|
|
626
|
+
|
|
627
|
+
this.clickable = false;
|
|
628
|
+
this.setState({
|
|
629
|
+
isDraw: false,
|
|
630
|
+
isCloseDraw: true,
|
|
631
|
+
isEndEdit: false,
|
|
632
|
+
graphicValue: null
|
|
633
|
+
}, function () {
|
|
634
|
+
_this5.setState({
|
|
635
|
+
isDraw: true,
|
|
636
|
+
isCloseDraw: false,
|
|
637
|
+
isEndEdit: true
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}, {
|
|
642
|
+
key: "editGraphic",
|
|
643
|
+
value: function editGraphic() {
|
|
644
|
+
var _this6 = this;
|
|
645
|
+
|
|
646
|
+
if (this.isDrawStatus && this.isClickMap) {
|
|
647
|
+
_message["default"].warning("请双击结束图元编辑");
|
|
648
|
+
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
_message["default"].info("请点击图元进行编辑");
|
|
653
|
+
|
|
654
|
+
this.clickable = true;
|
|
655
|
+
this.isDrawStatus = false;
|
|
656
|
+
this.setState({
|
|
657
|
+
isDraw: true,
|
|
658
|
+
isCloseDraw: false,
|
|
659
|
+
isDoEdit: false
|
|
660
|
+
}, function () {
|
|
661
|
+
_this6.setState({
|
|
662
|
+
isDraw: false,
|
|
663
|
+
isCloseDraw: true,
|
|
664
|
+
isDoEdit: true
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
}, {
|
|
669
|
+
key: "editGraphicChange",
|
|
670
|
+
value: function editGraphicChange(obj) {
|
|
671
|
+
var checkValue = this.state.checkValue;
|
|
672
|
+
console.log(checkValue); // 若坐标反查选中
|
|
673
|
+
|
|
674
|
+
if (checkValue) {
|
|
675
|
+
this.setState({
|
|
676
|
+
searchValue: "".concat(obj.geometry.x, ",").concat(obj.geometry.y)
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (!this.multiDraw) return;
|
|
681
|
+
var _this$state3 = this.state,
|
|
682
|
+
graphicValue = _this$state3.graphicValue,
|
|
683
|
+
editGraphic = _this$state3.editGraphic;
|
|
684
|
+
this.setState({
|
|
685
|
+
graphicValue: (graphicValue || []).map(function (item) {
|
|
686
|
+
return item.id === obj.id ? obj : item;
|
|
687
|
+
}),
|
|
688
|
+
editGraphic: (editGraphic || []).map(function (item) {
|
|
689
|
+
return item.id === obj.id ? obj : item;
|
|
690
|
+
})
|
|
691
|
+
});
|
|
692
|
+
} // 点位反查
|
|
693
|
+
|
|
694
|
+
}, {
|
|
695
|
+
key: "counterCheck",
|
|
696
|
+
value: function counterCheck() {
|
|
697
|
+
var checkValue = this.state.checkValue;
|
|
698
|
+
this.setState({
|
|
699
|
+
checkValue: !checkValue
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}, {
|
|
703
|
+
key: "render",
|
|
704
|
+
value: function render() {
|
|
705
|
+
var _this7 = this;
|
|
706
|
+
|
|
707
|
+
var t = this;
|
|
708
|
+
var _this$state4 = this.state,
|
|
709
|
+
isShowList = _this$state4.isShowList,
|
|
710
|
+
searchValue = _this$state4.searchValue,
|
|
711
|
+
locationPoint = _this$state4.locationPoint,
|
|
712
|
+
listPoint = _this$state4.listPoint,
|
|
713
|
+
listMess = _this$state4.listMess,
|
|
714
|
+
mapZoomLevel = _this$state4.mapZoomLevel,
|
|
715
|
+
setZoomLevel = _this$state4.setZoomLevel,
|
|
716
|
+
maxZoom = _this$state4.maxZoom,
|
|
717
|
+
minZoom = _this$state4.minZoom,
|
|
718
|
+
wkid = _this$state4.wkid,
|
|
719
|
+
mapServer = _this$state4.mapServer,
|
|
720
|
+
mapCenter = _this$state4.mapCenter,
|
|
721
|
+
setCenter = _this$state4.setCenter,
|
|
722
|
+
mapType = _this$state4.mapType,
|
|
723
|
+
mapStyle = _this$state4.mapStyle,
|
|
724
|
+
mapVisiblePoints = _this$state4.mapVisiblePoints,
|
|
725
|
+
setVisiblePoints = _this$state4.setVisiblePoints,
|
|
726
|
+
isDoEdit = _this$state4.isDoEdit,
|
|
727
|
+
editGraphicId = _this$state4.editGraphicId,
|
|
728
|
+
isEndEdit = _this$state4.isEndEdit,
|
|
729
|
+
modal1Visible = _this$state4.modal1Visible,
|
|
730
|
+
drawGraphID = _this$state4.drawGraphID,
|
|
731
|
+
isShowOther = _this$state4.isShowOther,
|
|
732
|
+
otherText = _this$state4.otherText,
|
|
733
|
+
isShowOtherGraph = _this$state4.isShowOtherGraph,
|
|
734
|
+
editGraphic = _this$state4.editGraphic,
|
|
735
|
+
graphicType = _this$state4.graphicType,
|
|
736
|
+
graphicValue = _this$state4.graphicValue,
|
|
737
|
+
olProps = _this$state4.olProps,
|
|
738
|
+
checkValue = _this$state4.checkValue;
|
|
739
|
+
var InputProps = {
|
|
740
|
+
style: {
|
|
741
|
+
width: "200px",
|
|
742
|
+
"margin-right": "10px"
|
|
743
|
+
},
|
|
744
|
+
placeholder: "输入关键字",
|
|
745
|
+
value: searchValue,
|
|
746
|
+
onChange: this.changeValue.bind(this),
|
|
747
|
+
onPressEnter: this.searchList.bind(this),
|
|
748
|
+
onKeyDown: this.changeValue.bind(this)
|
|
749
|
+
}; // 经纬度反查输入框
|
|
750
|
+
|
|
751
|
+
var checkInputProps = {
|
|
752
|
+
style: {
|
|
753
|
+
width: "200px",
|
|
754
|
+
"margin-right": "10px"
|
|
755
|
+
},
|
|
756
|
+
placeholder: "经度在前,英文逗号间隔",
|
|
757
|
+
value: searchValue,
|
|
758
|
+
onChange: this.changeValue.bind(this),
|
|
759
|
+
onPressEnter: this.searchList.bind(this),
|
|
760
|
+
onKeyDown: this.changeValue.bind(this)
|
|
761
|
+
};
|
|
762
|
+
var drawProps = this.state.graphicType == "point" || t.isinit ? {
|
|
763
|
+
isDraw: this.state.isDraw,
|
|
764
|
+
isCloseDraw: this.state.isCloseDraw
|
|
765
|
+
} : {
|
|
766
|
+
isDraw: this.state.isDraw,
|
|
767
|
+
isCloseDraw: this.state.isCloseDraw,
|
|
768
|
+
drawEnd: function drawEnd(obj) {
|
|
769
|
+
_this7.isDrawStatus = false;
|
|
770
|
+
_this7.isClickMap = false;
|
|
771
|
+
var objparam = {
|
|
772
|
+
graphicValue: _this7.multiDraw ? [].concat(_toConsumableArray(graphicValue || []), [obj]) : obj,
|
|
773
|
+
isDoEdit: !_this7.multiDraw,
|
|
774
|
+
isDraw: _this7.multiDraw
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
if (!_this7.multiDraw && (obj.geometryType == "polyline" || obj.geometryType == "polygon")) {
|
|
778
|
+
objparam.editGraphicId = obj.id;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
_this7.setState(objparam);
|
|
782
|
+
},
|
|
783
|
+
mapDraw: {
|
|
784
|
+
geometryType: this.state.graphicType,
|
|
785
|
+
parameter: this.state.parameter || (this.state.graphicType == "polyline" ? {
|
|
786
|
+
color: "#108edf",
|
|
787
|
+
//线颜色,
|
|
788
|
+
pellucidity: 1,
|
|
789
|
+
//线透明度,
|
|
790
|
+
lineWidth: 3,
|
|
791
|
+
//线宽度
|
|
792
|
+
lineType: "solid"
|
|
793
|
+
} : this.state.graphicType == "polygon" || this.state.graphicType == "circle" || this.state.graphicType == "rectangle" ? {
|
|
794
|
+
color: "#ffffff",
|
|
795
|
+
//填充色,
|
|
796
|
+
lineColor: "#108edf",
|
|
797
|
+
//线颜色,
|
|
798
|
+
lineOpacity: 1,
|
|
799
|
+
//线透明度,
|
|
800
|
+
lineWidth: 3,
|
|
801
|
+
//线宽度,
|
|
802
|
+
pellucidity: 0.8,
|
|
803
|
+
//填充透明度
|
|
804
|
+
lineType: "solid"
|
|
805
|
+
} : {}),
|
|
806
|
+
data: this.multiDraw ? null : {
|
|
807
|
+
id: drawGraphID
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var mapPoints = [],
|
|
812
|
+
mapLines = [],
|
|
813
|
+
mapPolygons = [],
|
|
814
|
+
mapCircles = [];
|
|
815
|
+
|
|
816
|
+
if (graphicType == "point") {
|
|
817
|
+
mapPoints = [].concat(_toConsumableArray(locationPoint), _toConsumableArray(listPoint));
|
|
818
|
+
} else {
|
|
819
|
+
mapPoints = _toConsumableArray(listPoint);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
if (graphicType === "polygon") {
|
|
823
|
+
if (editGraphic) {
|
|
824
|
+
var _mapPolygons;
|
|
825
|
+
|
|
826
|
+
Array.isArray(editGraphic) ? (_mapPolygons = mapPolygons).push.apply(_mapPolygons, _toConsumableArray(editGraphic)) : mapPolygons.push(editGraphic);
|
|
827
|
+
!this.multiDraw && (drawProps = null);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (graphicType === "polyline") {
|
|
832
|
+
if (editGraphic) {
|
|
833
|
+
mapLines.push(editGraphic);
|
|
834
|
+
drawProps = null;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
if (graphicType === "rectangle") {
|
|
839
|
+
if (editGraphic) {
|
|
840
|
+
mapPolygons.push(editGraphic);
|
|
841
|
+
drawProps = null;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
if (graphicType === "circle") {
|
|
846
|
+
if (editGraphic) {
|
|
847
|
+
mapCircles.push(editGraphic);
|
|
848
|
+
drawProps = null;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if (isShowOtherGraph) {
|
|
853
|
+
var otherGraph = this.props.otherGraph;
|
|
854
|
+
|
|
855
|
+
if (otherGraph) {
|
|
856
|
+
mapPoints = [].concat(_toConsumableArray(mapPoints), _toConsumableArray(otherGraph.point || []));
|
|
857
|
+
mapLines = [].concat(_toConsumableArray(mapLines), _toConsumableArray(otherGraph.polyline || []));
|
|
858
|
+
mapPolygons = [].concat(_toConsumableArray(mapPolygons), _toConsumableArray(otherGraph.polygon || []));
|
|
859
|
+
mapCircles = [].concat(_toConsumableArray(mapCircles), _toConsumableArray(otherGraph.circle || []));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
return /*#__PURE__*/_react["default"].createElement(_VtxModal.VtxModal, {
|
|
864
|
+
title: this.state.graphicType == "point" ? "定位" : "绘制",
|
|
865
|
+
style: {
|
|
866
|
+
top: 50
|
|
867
|
+
},
|
|
868
|
+
visible: modal1Visible,
|
|
869
|
+
maximize: true,
|
|
870
|
+
isNotMoving: true,
|
|
871
|
+
wrapClassName: styles.searchModal,
|
|
872
|
+
bodyStyle: {
|
|
873
|
+
height: "".concat(window.innerHeight * 0.7, "px")
|
|
874
|
+
},
|
|
875
|
+
maskClosable: false,
|
|
876
|
+
onCancel: this.closeModal.bind(this),
|
|
877
|
+
footer: /*#__PURE__*/_react["default"].createElement("div", {
|
|
878
|
+
className: styles.bottom
|
|
879
|
+
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
880
|
+
type: "primary",
|
|
881
|
+
onClick: function onClick() {
|
|
882
|
+
_this7.callback();
|
|
883
|
+
},
|
|
884
|
+
icon: getIcon("check")
|
|
885
|
+
}, "\u786E\u5B9A"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
886
|
+
onClick: this.closeModal.bind(this),
|
|
887
|
+
icon: getIcon("close")
|
|
888
|
+
}, "\u5173\u95ED"))
|
|
889
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
890
|
+
className: styles.searchMap
|
|
891
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
892
|
+
className: styles.top
|
|
893
|
+
}, mapType == "gmap" || mapType == "olmap" ? "" : [!checkValue ? /*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
|
|
894
|
+
key: "1"
|
|
895
|
+
}, InputProps)) : /*#__PURE__*/_react["default"].createElement(_input["default"], _extends({
|
|
896
|
+
key: "1"
|
|
897
|
+
}, checkInputProps)), this.state.graphicType == "point" ? /*#__PURE__*/_react["default"].createElement(_radio["default"], {
|
|
898
|
+
onClick: this.counterCheck.bind(this),
|
|
899
|
+
checked: checkValue
|
|
900
|
+
}, "\u5750\u6807\u53CD\u67E5") : null, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
901
|
+
key: "2",
|
|
902
|
+
type: "primary",
|
|
903
|
+
onClick: this.searchList.bind(this),
|
|
904
|
+
icon: getIcon("search")
|
|
905
|
+
}, "\u67E5\u8BE2"), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
906
|
+
key: "3",
|
|
907
|
+
onClick: this.clearList.bind(this),
|
|
908
|
+
icon: getIcon("close")
|
|
909
|
+
}, "\u6E05\u7A7A")], this.state.graphicType == "point" ? /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
910
|
+
onClick: this.correction.bind(this),
|
|
911
|
+
icon: getIcon("environment")
|
|
912
|
+
}, "\u6821\u6B63") : null, this.state.graphicType != "point" ? /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
913
|
+
disabled: this.isDrawStatus,
|
|
914
|
+
onClick: function onClick() {
|
|
915
|
+
_this7.isDrawStatus = true;
|
|
916
|
+
|
|
917
|
+
if (_this7.multiDraw) {
|
|
918
|
+
_this7.clickable = false;
|
|
919
|
+
graphicValue === null || graphicValue === void 0 ? void 0 : graphicValue.forEach(function (item) {
|
|
920
|
+
return t.map.removeGraphic(item.id, "draw");
|
|
921
|
+
});
|
|
922
|
+
editGraphic === null || editGraphic === void 0 ? void 0 : editGraphic.forEach(function (item) {
|
|
923
|
+
return t.map.removeGraphic(item.id, "draw");
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
_this7.setState({
|
|
927
|
+
isDraw: false,
|
|
928
|
+
isCloseDraw: true,
|
|
929
|
+
isEndEdit: false,
|
|
930
|
+
graphicValue: null,
|
|
931
|
+
editGraphic: null
|
|
932
|
+
}, function () {
|
|
933
|
+
_this7.setState({
|
|
934
|
+
isDraw: true,
|
|
935
|
+
isCloseDraw: false,
|
|
936
|
+
isEndEdit: true
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
} else {
|
|
940
|
+
_this7.setState({
|
|
941
|
+
isDraw: true,
|
|
942
|
+
graphicValue: null,
|
|
943
|
+
editGraphic: null,
|
|
944
|
+
isEndEdit: true
|
|
945
|
+
}, function () {
|
|
946
|
+
t.map.removeGraphic("drawnGraph", "draw");
|
|
947
|
+
t.setState({
|
|
948
|
+
isEndEdit: false
|
|
949
|
+
});
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
_this7.callback("editDraw");
|
|
954
|
+
},
|
|
955
|
+
icon: getIcon("edit")
|
|
956
|
+
}, "\u91CD\u65B0\u7ED8\u5236") : null, this.multiDraw && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
957
|
+
onClick: this.continueDraw.bind(this),
|
|
958
|
+
icon: getIcon("edit")
|
|
959
|
+
}, "\u7EE7\u7EED\u7ED8\u5236"), this.multiDraw && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
960
|
+
onClick: this.editGraphic.bind(this),
|
|
961
|
+
icon: getIcon("edit")
|
|
962
|
+
}, "\u7F16\u8F91\u56FE\u5143"), mapType == "gmap" || mapType == "olmap" ? "" : /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
963
|
+
onClick: this.setFitView.bind(this),
|
|
964
|
+
icon: getIcon("sync")
|
|
965
|
+
}, "\u8FD4\u56DE\u5168\u5C40\u5730\u56FE"), isShowOther ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
966
|
+
className: styles.otherModal
|
|
967
|
+
}, /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
968
|
+
checked: isShowOtherGraph,
|
|
969
|
+
onChange: function onChange(e) {
|
|
970
|
+
_this7.setState({
|
|
971
|
+
isShowOtherGraph: e.target.checked
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
}, otherText)) : ""), /*#__PURE__*/_react["default"].createElement("div", {
|
|
975
|
+
className: styles.content,
|
|
976
|
+
style: {
|
|
977
|
+
paddingLeft: mapType == "gmap" || mapType == "olmap" ? "0px" : "25px"
|
|
978
|
+
}
|
|
979
|
+
}, mapType == "gmap" || mapType == "olmap" ? "" : /*#__PURE__*/_react["default"].createElement("div", {
|
|
980
|
+
className: "".concat(styles.content_left, " ").concat(isShowList ? styles.w_l : "")
|
|
981
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
982
|
+
className: "".concat(isShowList ? styles.show : styles.hidden)
|
|
983
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
984
|
+
className: styles.listTitle
|
|
985
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
986
|
+
className: styles.title
|
|
987
|
+
}, "\u67E5\u8BE2\u7ED3\u679C"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
988
|
+
onClick: function onClick() {
|
|
989
|
+
return _this7.showOrhidden(false);
|
|
990
|
+
},
|
|
991
|
+
className: styles.btn
|
|
992
|
+
}, /*#__PURE__*/_react["default"].createElement(_default2.VtxMapIcon, {
|
|
993
|
+
type: "icon-doubleleft"
|
|
994
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
995
|
+
className: styles.scrollauto
|
|
996
|
+
}, listMess.map(function (item, index) {
|
|
997
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
998
|
+
key: index,
|
|
999
|
+
onClick: function onClick() {
|
|
1000
|
+
return _this7.chooseAddress(item.id);
|
|
1001
|
+
},
|
|
1002
|
+
className: "".concat(styles.lists, " ").concat(item.isSelect ? styles.select : "")
|
|
1003
|
+
}, item.title);
|
|
1004
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1005
|
+
onClick: function onClick() {
|
|
1006
|
+
return _this7.showOrhidden(true);
|
|
1007
|
+
},
|
|
1008
|
+
className: "".concat(styles.btn, " ").concat(!isShowList ? styles.show : styles.hidden)
|
|
1009
|
+
}, /*#__PURE__*/_react["default"].createElement(_default2.VtxMapIcon, {
|
|
1010
|
+
type: "icon-doubleright"
|
|
1011
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1012
|
+
className: styles.content_right
|
|
1013
|
+
}, /*#__PURE__*/_react["default"].createElement(_VtxMap.VtxMap, _extends({
|
|
1014
|
+
getMapInstance: function getMapInstance(map) {
|
|
1015
|
+
if (map) _this7.map = map;
|
|
1016
|
+
},
|
|
1017
|
+
mapType: mapType,
|
|
1018
|
+
mapStyle: mapStyle,
|
|
1019
|
+
mapServer: mapServer,
|
|
1020
|
+
wkid: wkid,
|
|
1021
|
+
mapId: t.mapId,
|
|
1022
|
+
setCenter: setCenter,
|
|
1023
|
+
mapCenter: mapCenter,
|
|
1024
|
+
minZoom: minZoom,
|
|
1025
|
+
maxZoom: maxZoom,
|
|
1026
|
+
mapZoomLevel: mapZoomLevel,
|
|
1027
|
+
setZoomLevel: setZoomLevel,
|
|
1028
|
+
mapPoints: mapPoints,
|
|
1029
|
+
mapLines: mapLines,
|
|
1030
|
+
mapPolygons: mapPolygons,
|
|
1031
|
+
mapCircles: mapCircles,
|
|
1032
|
+
mapVisiblePoints: mapVisiblePoints,
|
|
1033
|
+
setVisiblePoints: setVisiblePoints,
|
|
1034
|
+
isDoEdit: isDoEdit,
|
|
1035
|
+
isEndEdit: isEndEdit,
|
|
1036
|
+
editGraphicId: editGraphicId,
|
|
1037
|
+
editGraphicChange: this.editGraphicChange.bind(this),
|
|
1038
|
+
clickGraphic: this.clickGraphic.bind(this),
|
|
1039
|
+
clickMap: function clickMap() {
|
|
1040
|
+
t.isClickMap = true;
|
|
1041
|
+
},
|
|
1042
|
+
olProps: olProps
|
|
1043
|
+
}, drawProps))))));
|
|
1044
|
+
}
|
|
1045
|
+
}, {
|
|
1046
|
+
key: "initSearchMap",
|
|
1047
|
+
value: function initSearchMap() {
|
|
1048
|
+
var _this8 = this;
|
|
1049
|
+
|
|
1050
|
+
if (this.props.modal1Visible
|
|
1051
|
+
/*&& !this.state.locationPoint[0]*/
|
|
1052
|
+
) {
|
|
1053
|
+
if (this.map) {
|
|
1054
|
+
this.map.loadMapComplete.then(function () {
|
|
1055
|
+
if (!_this8.mapLoaded) {
|
|
1056
|
+
_this8.mapLoaded = true;
|
|
1057
|
+
|
|
1058
|
+
_this8.drawLocationPoint();
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}, {
|
|
1065
|
+
key: "componentDidMount",
|
|
1066
|
+
value: function componentDidMount() {
|
|
1067
|
+
//绘制定位点(以当前的中心点位参照=>初始化好后才有ref可以获取中心点)
|
|
1068
|
+
this.initSearchMap();
|
|
1069
|
+
}
|
|
1070
|
+
}, {
|
|
1071
|
+
key: "componentDidUpdate",
|
|
1072
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1073
|
+
//重新渲染结束
|
|
1074
|
+
this.initSearchMap();
|
|
1075
|
+
}
|
|
1076
|
+
}, {
|
|
1077
|
+
key: "componentWillReceiveProps",
|
|
1078
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
1079
|
+
var _this9 = this;
|
|
1080
|
+
|
|
1081
|
+
var t = this;
|
|
1082
|
+
this.isClickMap = false;
|
|
1083
|
+
|
|
1084
|
+
if (t.state.graphicType !== nextProps.graphicType && !!this.map) {
|
|
1085
|
+
this.map.clearAll();
|
|
1086
|
+
t.mapLoaded = false;
|
|
1087
|
+
t.isinit = true;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
if (nextProps.editParam) {
|
|
1091
|
+
t.mapLoaded = false;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
t.isDrawStatus = nextProps.graphicType !== "point" && !nextProps.editParam;
|
|
1095
|
+
this.setState({
|
|
1096
|
+
modal1Visible: nextProps.modal1Visible,
|
|
1097
|
+
maxZoom: nextProps.maxZoom,
|
|
1098
|
+
minZoom: nextProps.minZoom,
|
|
1099
|
+
wkid: nextProps.wkid,
|
|
1100
|
+
mapCenter: nextProps.mapCenter || "",
|
|
1101
|
+
mapType: nextProps.mapType || "bmap",
|
|
1102
|
+
mapStyle: nextProps.mapStyle,
|
|
1103
|
+
mapServer: nextProps.mapServer,
|
|
1104
|
+
graphicType: nextProps.graphicType || "point",
|
|
1105
|
+
isDraw: nextProps.graphicType !== "point" && !nextProps.editParam,
|
|
1106
|
+
isCloseDraw: !(nextProps.graphicType !== "point" && !nextProps.editParam),
|
|
1107
|
+
editGraphicId: ""
|
|
1108
|
+
}, function () {
|
|
1109
|
+
t.setState({
|
|
1110
|
+
isCloseDraw: false
|
|
1111
|
+
});
|
|
1112
|
+
t.initSearchMap();
|
|
1113
|
+
});
|
|
1114
|
+
setTimeout(function () {
|
|
1115
|
+
//实现2+次进入时,清理数据
|
|
1116
|
+
if (nextProps.modal1Visible) {
|
|
1117
|
+
_this9.clearList();
|
|
1118
|
+
|
|
1119
|
+
_this9.setState({
|
|
1120
|
+
setZoomLevel: true
|
|
1121
|
+
}, function () {
|
|
1122
|
+
_this9.setState({
|
|
1123
|
+
setZoomLevel: false
|
|
1124
|
+
});
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
if (!!_this9.map && !!_this9.state.locationPoint[0] && nextProps.mapCenter && !!nextProps.mapCenter[0]) {
|
|
1128
|
+
if (_this9.map.getGraphic("locationPoint")) {
|
|
1129
|
+
switch (nextProps.mapType) {
|
|
1130
|
+
case "bmap":
|
|
1131
|
+
_this9.map.getGraphic("locationPoint").mapLayer.setPosition(new BMap.Point(nextProps.mapCenter[0], nextProps.mapCenter[1]));
|
|
1132
|
+
|
|
1133
|
+
break;
|
|
1134
|
+
|
|
1135
|
+
case "amap":
|
|
1136
|
+
_this9.map.getGraphic("locationPoint").mapLayer.setPosition(new AMap.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
|
|
1137
|
+
|
|
1138
|
+
break;
|
|
1139
|
+
|
|
1140
|
+
case "tmap":
|
|
1141
|
+
_this9.map.getGraphic("locationPoint").mapLayer.setLngLat(new T.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
|
|
1142
|
+
|
|
1143
|
+
break;
|
|
1144
|
+
|
|
1145
|
+
case "gmap":
|
|
1146
|
+
_this9.map.getGraphic("locationPoint").mapLayer.geometry.setLatitude(nextProps.mapCenter[1]);
|
|
1147
|
+
|
|
1148
|
+
_this9.map.getGraphic("locationPoint").mapLayer.geometry.setLongitude(nextProps.mapCenter[0]);
|
|
1149
|
+
|
|
1150
|
+
_this9.map.state.gis.graphics.refresh();
|
|
1151
|
+
|
|
1152
|
+
case "olMap":
|
|
1153
|
+
_this9.map.getGraphic("locationPoint").mapLayer.setGeometry(new ol.geom.Point(nextProps.mapCenter));
|
|
1154
|
+
|
|
1155
|
+
break;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
_this9.map.setCenter(nextProps.mapCenter);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}, 100);
|
|
1163
|
+
}
|
|
1164
|
+
}, {
|
|
1165
|
+
key: "componentWillUnmount",
|
|
1166
|
+
value: function componentWillUnmount() {
|
|
1167
|
+
//关闭moveTo定时
|
|
1168
|
+
var t = this;
|
|
1169
|
+
|
|
1170
|
+
if (t.loadExtent) {
|
|
1171
|
+
clearInterval(t.loadExtent);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}]);
|
|
1175
|
+
|
|
1176
|
+
return VtxSearchCheckMap;
|
|
1177
|
+
}(_react["default"].Component);
|
|
1178
|
+
|
|
1179
|
+
var _default = VtxSearchCheckMap;
|
|
1180
|
+
exports["default"] = _default;
|
|
1181
|
+
module.exports = exports["default"];
|
|
1182
|
+
//# sourceMappingURL=VtxSearchCheckMap.js.map
|