@vtx/map 1.2.17 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/VtxMap/OlMap/Map.js +272 -3
- package/lib/VtxMap/OlMap/Map.js.map +1 -1
- package/lib/VtxSearchMap/VtxSearchMap.css +11 -0
- package/lib/VtxSearchMap/VtxSearchMap.js +75 -7
- package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
- package/lib/VtxSearchMap/VtxSearchMap.less +9 -0
- package/lib/utils/util.js +11 -1
- package/lib/utils/util.js.map +1 -1
- package/package.json +1 -1
|
@@ -189,3 +189,14 @@
|
|
|
189
189
|
.vtx-ui-searchmap-hiddenlabel {
|
|
190
190
|
display: none;
|
|
191
191
|
}
|
|
192
|
+
.vtx-ui-searchmap-bottom {
|
|
193
|
+
display: -webkit-box;
|
|
194
|
+
display: -ms-flexbox;
|
|
195
|
+
display: flex;
|
|
196
|
+
-webkit-box-align: center;
|
|
197
|
+
-ms-flex-align: center;
|
|
198
|
+
align-items: center;
|
|
199
|
+
-webkit-box-pack: justify;
|
|
200
|
+
-ms-flex-pack: justify;
|
|
201
|
+
justify-content: space-between;
|
|
202
|
+
}
|
|
@@ -110,7 +110,8 @@ var styles = {
|
|
|
110
110
|
hiddenLabel: 'vtx-ui-searchmap-hiddenlabel',
|
|
111
111
|
otherModal: 'vtx-ui-searchmap-othermodal',
|
|
112
112
|
mapTxt: 'vtx-ui-searchmap-mapTxt',
|
|
113
|
-
switchMap: 'vtx-ui-searchmap-switch-map'
|
|
113
|
+
switchMap: 'vtx-ui-searchmap-switch-map',
|
|
114
|
+
address: 'vtx-ui-searchmap-address'
|
|
114
115
|
};
|
|
115
116
|
var CoverageTypes = [{
|
|
116
117
|
name: '矢量底图',
|
|
@@ -199,7 +200,10 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
199
200
|
_this.loadExtent = null;
|
|
200
201
|
_this.mapId = "searchMap".concat(new Date().getTime());
|
|
201
202
|
_this.multiDraw = props.multiDraw && ['polygon', 'polyline'].includes(props.graphicType);
|
|
202
|
-
_this.clickable = false
|
|
203
|
+
_this.clickable = false; // 多个面绘制时,是否可以点击面进行编辑
|
|
204
|
+
|
|
205
|
+
_this.prefixUrl = props.prefixUrl || '';
|
|
206
|
+
_this.searchPoiUrl = props.searchPoiUrl || '';
|
|
203
207
|
_this.state = {
|
|
204
208
|
//列表和地图宽度切换的动画需要
|
|
205
209
|
isShowList: false,
|
|
@@ -257,7 +261,9 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
257
261
|
// 自定义右上角功能
|
|
258
262
|
customNodes: props.customNodes || null,
|
|
259
263
|
// 查询模式
|
|
260
|
-
searchMode: props.searchMode || 'keyword'
|
|
264
|
+
searchMode: props.searchMode || 'keyword',
|
|
265
|
+
// LBS解析后的地址
|
|
266
|
+
lbsAddress: ''
|
|
261
267
|
};
|
|
262
268
|
_this.TextEnum = _objectSpread({
|
|
263
269
|
locationTitleText: '定位',
|
|
@@ -540,6 +546,52 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
540
546
|
} else {
|
|
541
547
|
t.searchPointsLBS();
|
|
542
548
|
}
|
|
549
|
+
} // lbs解析经纬度为地址
|
|
550
|
+
|
|
551
|
+
}, {
|
|
552
|
+
key: "convertAddressByLnglat",
|
|
553
|
+
value: function convertAddressByLnglat() {
|
|
554
|
+
var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
555
|
+
console.log(obj);
|
|
556
|
+
var t = this;
|
|
557
|
+
var lnglat = '';
|
|
558
|
+
|
|
559
|
+
if (obj.geometry && obj.geometry.type && ['point', 'circle'].includes(obj.geometry.type)) {
|
|
560
|
+
lnglat = "".concat(obj.geometry.x, ",").concat(obj.geometry.y);
|
|
561
|
+
} else if (obj.geometry && obj.geometry.paths) {
|
|
562
|
+
lnglat = getAvg(obj.geometry.paths);
|
|
563
|
+
} else if (obj.geometry && obj.geometry.rings) {
|
|
564
|
+
lnglat = getAvg(obj.geometry.rings);
|
|
565
|
+
} else if (obj.geometry && obj.geometry.rings) {
|
|
566
|
+
lnglat = getAvg(obj.geometry.rings);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (!!lnglat) {
|
|
570
|
+
$.ajax({
|
|
571
|
+
url: "".concat(t.prefixUrl, "/vortexapi/rest/lbs/geoconvert/v2"),
|
|
572
|
+
method: "GET",
|
|
573
|
+
data: {
|
|
574
|
+
location: lnglat,
|
|
575
|
+
coordtype: _util.MapTypeEnum[t.state.mapType],
|
|
576
|
+
batch: false
|
|
577
|
+
},
|
|
578
|
+
headers: {
|
|
579
|
+
'authorization': "Bearer ".concat((0, _util.getToken)())
|
|
580
|
+
},
|
|
581
|
+
success: function success(res) {
|
|
582
|
+
if ((res === null || res === void 0 ? void 0 : res.result) === 0) {
|
|
583
|
+
var _res$data;
|
|
584
|
+
|
|
585
|
+
t.setState({
|
|
586
|
+
lbsAddress: ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.address) || ''
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
fail: function fail(res) {
|
|
591
|
+
_message["default"].warn("");
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
543
595
|
} // 从lbs中查询
|
|
544
596
|
|
|
545
597
|
}, {
|
|
@@ -547,7 +599,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
547
599
|
value: function searchPointsLBS() {
|
|
548
600
|
var t = this;
|
|
549
601
|
$.ajax({
|
|
550
|
-
url: "/vortexapi/rest/lbs/poi",
|
|
602
|
+
url: t.searchPoiUrl || "".concat(t.prefixUrl, "/vortexapi/rest/lbs/poi"),
|
|
551
603
|
method: "GET",
|
|
552
604
|
data: {
|
|
553
605
|
keywords: t.state.searchValue,
|
|
@@ -748,7 +800,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
748
800
|
|
|
749
801
|
var disableEditIds = this.getAllOtherGraphId();
|
|
750
802
|
|
|
751
|
-
if (disableEditIds.includes(obj.attributes.id)) {
|
|
803
|
+
if (obj.attributes && disableEditIds.includes(obj.attributes.id)) {
|
|
752
804
|
_message["default"].warn(this.TextEnum.msgDoNotAllowOtherGraph);
|
|
753
805
|
} else {
|
|
754
806
|
if (obj.type === 'point' && obj.attributes.other === 'search') {
|
|
@@ -860,6 +912,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
860
912
|
}, {
|
|
861
913
|
key: "editGraphicChange",
|
|
862
914
|
value: function editGraphicChange(obj) {
|
|
915
|
+
this.convertAddressByLnglat(obj);
|
|
863
916
|
if (!this.multiDraw) return;
|
|
864
917
|
var _this$state3 = this.state,
|
|
865
918
|
graphicValue = _this$state3.graphicValue,
|
|
@@ -1040,6 +1093,8 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1040
1093
|
}
|
|
1041
1094
|
|
|
1042
1095
|
_this8.setState(objparam);
|
|
1096
|
+
|
|
1097
|
+
_this8.convertAddressByLnglat(obj);
|
|
1043
1098
|
},
|
|
1044
1099
|
mapDraw: {
|
|
1045
1100
|
geometryType: this.state.graphicType,
|
|
@@ -1144,7 +1199,9 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1144
1199
|
onCancel: this.closeModal.bind(this),
|
|
1145
1200
|
footer: /*#__PURE__*/_react["default"].createElement("div", {
|
|
1146
1201
|
className: styles.bottom
|
|
1147
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
1202
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1203
|
+
className: styles.address
|
|
1204
|
+
}, this.state.lbsAddress || ''), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
1148
1205
|
type: "primary",
|
|
1149
1206
|
onClick: function onClick() {
|
|
1150
1207
|
if (_this8.multiDraw && _this8.state.isDoEdit && !_this8.state.isEndEdit) {
|
|
@@ -1159,7 +1216,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1159
1216
|
}, TextEnum.footerConfirmBtnText), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
1160
1217
|
onClick: this.closeModal.bind(this),
|
|
1161
1218
|
icon: getIcon('close')
|
|
1162
|
-
}, TextEnum.footerCancelBtnText))
|
|
1219
|
+
}, TextEnum.footerCancelBtnText)))
|
|
1163
1220
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1164
1221
|
className: styles.searchMap
|
|
1165
1222
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1514,5 +1571,16 @@ function formatNumber(num) {
|
|
|
1514
1571
|
return Number(num).toFixed(2);
|
|
1515
1572
|
}
|
|
1516
1573
|
|
|
1574
|
+
function getAvg() {
|
|
1575
|
+
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1576
|
+
var sumLng = 0,
|
|
1577
|
+
sumLat = 0;
|
|
1578
|
+
arr.forEach(function (item) {
|
|
1579
|
+
sumLng += Number(item[0]);
|
|
1580
|
+
sumLat += Number(item[1]);
|
|
1581
|
+
});
|
|
1582
|
+
return "".concat(sumLng / arr.length, ",").concat(sumLat / arr.length);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1517
1585
|
module.exports = exports["default"];
|
|
1518
1586
|
//# sourceMappingURL=VtxSearchMap.js.map
|