@vtx/map 1.2.33 → 1.2.35

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.
@@ -434,7 +434,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
434
434
  longitude = _t$state$searchValue$2[0],
435
435
  latitude = _t$state$searchValue$2[1];
436
436
  t.setState({
437
- mapCenter: [longitude, latitude],
437
+ mapCenter: [Number(longitude), Number(latitude)],
438
438
  setCenter: true
439
439
  }, function () {
440
440
  t.setState({
@@ -476,15 +476,23 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
476
476
  } else if (obj.geometry && obj.geometry.rings) {
477
477
  lnglat = getAvg(obj.geometry.rings);
478
478
  }
479
+ var olProps = t.props.olProps;
480
+ var config = {};
481
+ if (olProps !== null && olProps !== void 0 && olProps.epsg) {
482
+ config = {
483
+ epsg: olProps === null || olProps === void 0 ? void 0 : olProps.epsg,
484
+ coordtype: 'cgcs2000'
485
+ };
486
+ }
479
487
  if (!!lnglat) {
480
488
  $.ajax({
481
489
  url: "".concat(t.prefixUrl, "/cloudLbs/vortexapi/rest/lbs/geoconvert/v2"),
482
490
  method: "GET",
483
- data: {
491
+ data: _objectSpread({
484
492
  location: lnglat,
485
493
  coordtype: _util.MapTypeEnum[t.state.mapType],
486
494
  batch: false
487
- },
495
+ }, config),
488
496
  headers: {
489
497
  'authorization': "Bearer ".concat((0, _util.getToken)())
490
498
  },
@@ -1319,11 +1327,10 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1319
1327
  }, {
1320
1328
  key: "UNSAFE_componentWillReceiveProps",
1321
1329
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
1322
- var _this0 = this;
1323
1330
  var t = this;
1324
- this.isClickMap = false;
1325
- if (t.state.graphicType !== nextProps.graphicType && !!this.map) {
1326
- this.map.clearAll();
1331
+ t.isClickMap = false;
1332
+ if (t.state.graphicType !== nextProps.graphicType && !!t.map) {
1333
+ t.map.clearAll();
1327
1334
  t.mapLoaded = false;
1328
1335
  t.isinit = true;
1329
1336
  }
@@ -1331,7 +1338,7 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1331
1338
  t.mapLoaded = false;
1332
1339
  }
1333
1340
  t.isDrawStatus = nextProps.graphicType !== 'point' && !nextProps.editParam;
1334
- this.setState({
1341
+ t.setState({
1335
1342
  modal1Visible: nextProps.modal1Visible,
1336
1343
  maxZoom: nextProps.maxZoom,
1337
1344
  minZoom: nextProps.minZoom,
@@ -1354,36 +1361,38 @@ var VtxSearchMap = /*#__PURE__*/function (_React$Component) {
1354
1361
  setTimeout(function () {
1355
1362
  //实现2+次进入时,清理数据
1356
1363
  if (nextProps.modal1Visible) {
1357
- _this0.clearList();
1358
- _this0.setState({
1364
+ t.clearList();
1365
+ t.setState({
1359
1366
  setZoomLevel: true
1360
1367
  }, function () {
1361
- _this0.setState({
1368
+ t.setState({
1362
1369
  setZoomLevel: false
1363
1370
  });
1364
1371
  });
1365
- if (!!_this0.map && !!_this0.state.locationPoint[0] && nextProps.mapCenter && !!nextProps.mapCenter[0]) {
1366
- if (_this0.map.getGraphic('locationPoint')) {
1372
+ if (!!t.map && !!t.state.locationPoint[0] && nextProps.mapCenter && !!nextProps.mapCenter[0]) {
1373
+ if (t.map.getGraphic('locationPoint')) {
1367
1374
  switch (nextProps.mapType) {
1368
1375
  case 'bmap':
1369
- _this0.map.getGraphic('locationPoint').mapLayer.setPosition(new BMap.Point(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1376
+ t.map.getGraphic('locationPoint').mapLayer.setPosition(new BMap.Point(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1370
1377
  break;
1371
1378
  case 'amap':
1372
- _this0.map.getGraphic('locationPoint').mapLayer.setPosition(new AMap.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1379
+ t.map.getGraphic('locationPoint').mapLayer.setPosition(new AMap.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1373
1380
  break;
1374
1381
  case 'tmap':
1375
- _this0.map.getGraphic('locationPoint').mapLayer.setLngLat(new T.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1382
+ t.map.getGraphic('locationPoint').mapLayer.setLngLat(new T.LngLat(nextProps.mapCenter[0], nextProps.mapCenter[1]));
1376
1383
  break;
1377
1384
  case 'gmap':
1378
- _this0.map.getGraphic('locationPoint').mapLayer.geometry.setLatitude(nextProps.mapCenter[1]);
1379
- _this0.map.getGraphic('locationPoint').mapLayer.geometry.setLongitude(nextProps.mapCenter[0]);
1380
- _this0.map.state.gis.graphics.refresh();
1385
+ if (t.map.getGraphic('locationPoint').mapLayer.geometry.setLatitude) {
1386
+ t.map.getGraphic('locationPoint').mapLayer.geometry.setLatitude(nextProps.mapCenter[1]);
1387
+ t.map.getGraphic('locationPoint').mapLayer.geometry.setLongitude(nextProps.mapCenter[0]);
1388
+ t.map.state.gis.graphics.refresh();
1389
+ }
1381
1390
  case 'olMap':
1382
- window.ol && _this0.map.getGraphic('locationPoint').mapLayer.setGeometry(new ol.geom.Point(nextProps.mapCenter));
1391
+ window.ol && t.map.getGraphic('locationPoint').mapLayer.setGeometry(new ol.geom.Point(nextProps.mapCenter));
1383
1392
  break;
1384
1393
  }
1385
1394
  }
1386
- _this0.map.setCenter(nextProps.mapCenter);
1395
+ t.map.setCenter(nextProps.mapCenter);
1387
1396
  }
1388
1397
  }
1389
1398
  }, 100);