@vtx/map 1.1.48 → 1.1.49

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.
@@ -192,11 +192,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
192
192
  clusters: null,
193
193
  clusterCircles: null
194
194
  };
195
+ _this.mapCreated = false;
195
196
  _this.state = {
196
197
  gis: null,
197
198
  //地图对象
198
199
  mapId: props.mapId,
199
- mapCreated: false,
200
200
  pointIds: [],
201
201
  //地图上点的ids
202
202
  lineIds: [],
@@ -259,6 +259,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
259
259
  }, {
260
260
  key: "init",
261
261
  value: function init() {
262
+ var _this2 = this;
262
263
  var t = this;
263
264
  // 创建地图
264
265
  t.createMap();
@@ -321,9 +322,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
321
322
  if (areaRestriction && !!areaRestriction[0] && !!areaRestriction[1]) {
322
323
  t.setAreaRestriction(areaRestriction);
323
324
  }
324
- t.setState({
325
- mapCreated: true
326
- });
325
+ _this2.mapCreated = true;
327
326
  };
328
327
  var event = function event(e, status) {
329
328
  var gis = t.state.gis;
@@ -1963,13 +1962,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1963
1962
  }, {
1964
1963
  key: "addPoint",
1965
1964
  value: function addPoint(mapPoints, type) {
1966
- var _this2 = this;
1965
+ var _this3 = this;
1967
1966
  var t = this;
1968
1967
  var ps = [];
1969
1968
  var psids = _toConsumableArray(t.state.pointIds);
1970
1969
  mapPoints.map(function (item, index) {
1971
1970
  //如果id重复,直接跳过不执行.
1972
- if (_this2.GM.isRepetition(item.id)) {
1971
+ if (_this3.GM.isRepetition(item.id)) {
1973
1972
  console.warn("\u52A0\u70B9id: ".concat(item.id, " \u91CD\u590D"));
1974
1973
  return false;
1975
1974
  }
@@ -2120,7 +2119,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2120
2119
  }
2121
2120
  psids.push(item.id);
2122
2121
  //缓存图元的数据,偏于后期操作
2123
- _this2.GM.setGraphic(item.id, feature).setGraphicParam(item.id, {
2122
+ _this3.GM.setGraphic(item.id, feature).setGraphicParam(item.id, {
2124
2123
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2125
2124
  other: item
2126
2125
  }),
@@ -2144,12 +2143,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2144
2143
  }, {
2145
2144
  key: "updatePoint",
2146
2145
  value: function updatePoint() {
2147
- var _this3 = this;
2146
+ var _this4 = this;
2148
2147
  var mapPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2149
2148
  var t = this;
2150
2149
  var index = 0;
2151
2150
  var dealPoint = function dealPoint(item) {
2152
- if (_this3.GM.isRepetition(item.id)) {
2151
+ if (_this4.GM.isRepetition(item.id)) {
2153
2152
  //点位数据不符合,直接跳过
2154
2153
  if (!item.longitude || !item.latitude) {
2155
2154
  console.warn("\u70B9 \u7ECF\u7EAC\u5EA6 \u6570\u636E\u9519\u8BEF");
@@ -2251,7 +2250,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2251
2250
  }
2252
2251
  }
2253
2252
  gc.setGeometry(new ol.geom.Point([parseFloat(item.longitude), parseFloat(item.latitude)]));
2254
- _this3.GM.setGraphicParam(item.id, {
2253
+ _this4.GM.setGraphicParam(item.id, {
2255
2254
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2256
2255
  other: item
2257
2256
  }),
@@ -2295,14 +2294,14 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2295
2294
  }, {
2296
2295
  key: "addLine",
2297
2296
  value: function addLine(mapLines, type) {
2298
- var _this4 = this;
2297
+ var _this5 = this;
2299
2298
  var t = this;
2300
2299
  var ls = [];
2301
2300
  var lsids = _toConsumableArray(t.state.lineIds);
2302
2301
  //遍历添加线(图元)
2303
2302
  mapLines.map(function (item, index) {
2304
2303
  //如果id重复,直接跳过不执行.
2305
- if (_this4.GM.isRepetition(item.id)) {
2304
+ if (_this5.GM.isRepetition(item.id)) {
2306
2305
  console.warn("\u591A\u6298\u7EBFid: ".concat(item.id, " \u91CD\u590D"));
2307
2306
  return false;
2308
2307
  }
@@ -2349,7 +2348,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2349
2348
  var pts = item.paths.map(function (itt, ind) {
2350
2349
  return _toConsumableArray(itt);
2351
2350
  });
2352
- _this4.GM.setGraphic(item.id, polyline).setGraphicParam(item.id, {
2351
+ _this5.GM.setGraphic(item.id, polyline).setGraphicParam(item.id, {
2353
2352
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2354
2353
  paths: pts,
2355
2354
  other: item
@@ -2373,12 +2372,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2373
2372
  }, {
2374
2373
  key: "updateLine",
2375
2374
  value: function updateLine(mapLines) {
2376
- var _this5 = this;
2375
+ var _this6 = this;
2377
2376
  var t = this;
2378
2377
  //遍历添加线(图元)
2379
2378
  mapLines.map(function (item, index) {
2380
2379
  //判断图元是否存在.
2381
- if (_this5.GM.isRepetition(item.id)) {
2380
+ if (_this6.GM.isRepetition(item.id)) {
2382
2381
  //多折线点位数据不符合,直接跳过
2383
2382
  if (!(item.paths && item.paths.length >= 2)) {
2384
2383
  console.warn("\u591A\u6298\u7EBFpaths\u6570\u636E\u9519\u8BEF");
@@ -2394,8 +2393,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2394
2393
  isHidden: false
2395
2394
  };
2396
2395
  //获取原有的图元
2397
- var gc = _this5.GM.getGraphic(item.id);
2398
- var gp = _this5.GM.getGraphicParam(item.id);
2396
+ var gc = _this6.GM.getGraphic(item.id);
2397
+ var gp = _this6.GM.getGraphicParam(item.id);
2399
2398
  //重新初始化值
2400
2399
  if (item.config) {
2401
2400
  cg = _objectSpread(_objectSpread({}, cg), item.config);
@@ -2415,7 +2414,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2415
2414
  return style;
2416
2415
  });
2417
2416
  gc.setGeometry(new ol.geom.LineString(pts));
2418
- _this5.GM.setGraphicParam(item.id, {
2417
+ _this6.GM.setGraphicParam(item.id, {
2419
2418
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2420
2419
  paths: pts,
2421
2420
  other: item
@@ -2437,14 +2436,14 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2437
2436
  }, {
2438
2437
  key: "addPolygon",
2439
2438
  value: function addPolygon(mapPolygons) {
2440
- var _this6 = this;
2439
+ var _this7 = this;
2441
2440
  var t = this;
2442
2441
  var pgs = [];
2443
2442
  var pgsids = _toConsumableArray(t.state.polygonIds);
2444
2443
  //遍历添加面(图元)
2445
2444
  mapPolygons.map(function (item, index) {
2446
2445
  //如果id重复,直接跳过不执行.
2447
- if (_this6.GM.isRepetition(item.id)) {
2446
+ if (_this7.GM.isRepetition(item.id)) {
2448
2447
  console.warn("\u591A\u8FB9\u5F62id: ".concat(item.id, " \u91CD\u590D"));
2449
2448
  return false;
2450
2449
  }
@@ -2495,7 +2494,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2495
2494
  var pts = item.rings.map(function (itt, ind) {
2496
2495
  return _toConsumableArray(itt);
2497
2496
  });
2498
- _this6.GM.setGraphic(item.id, polygon).setGraphicParam(item.id, {
2497
+ _this7.GM.setGraphic(item.id, polygon).setGraphicParam(item.id, {
2499
2498
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2500
2499
  rings: pts,
2501
2500
  other: item
@@ -2516,18 +2515,18 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2516
2515
  }, {
2517
2516
  key: "updatePolygon",
2518
2517
  value: function updatePolygon(mapPolygons) {
2519
- var _this7 = this;
2518
+ var _this8 = this;
2520
2519
  var t = this;
2521
2520
  mapPolygons.map(function (item, index) {
2522
2521
  //判断图元是否存在.
2523
- if (_this7.GM.isRepetition(item.id)) {
2522
+ if (_this8.GM.isRepetition(item.id)) {
2524
2523
  //多边形点位数据不符合,直接跳过
2525
2524
  if (!(item.rings && item.rings.length >= 3)) {
2526
2525
  console.warn("\u591A\u8FB9\u5F62rings\u6570\u636E\u9519\u8BEF");
2527
2526
  return false;
2528
2527
  }
2529
2528
  //获取原有的图元
2530
- var gc = _this7.GM.getGraphic(item.id);
2529
+ var gc = _this8.GM.getGraphic(item.id);
2531
2530
  var gp = t.GM.getGraphicParam(item.id);
2532
2531
  //获取原有的面属性,转换key值
2533
2532
  var cg = {
@@ -2556,7 +2555,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2556
2555
  color: cg.pellucidity ? getRgbColor(cg.color, cg.pellucidity) : cg.color
2557
2556
  })
2558
2557
  }));
2559
- _this7.GM.setGraphicParam(item.id, {
2558
+ _this8.GM.setGraphicParam(item.id, {
2560
2559
  attributes: _objectSpread(_objectSpread({}, item), {}, {
2561
2560
  rings: pts,
2562
2561
  other: item
@@ -3580,8 +3579,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3580
3579
  }
3581
3580
  //已加载组件,收到新的参数时调用
3582
3581
  }, {
3583
- key: "componentWillReceiveProps",
3584
- value: function componentWillReceiveProps(nextProps, prevProps) {
3582
+ key: "UNSAFE_componentWillReceiveProps",
3583
+ value: function UNSAFE_componentWillReceiveProps(nextProps, prevProps) {
3585
3584
  var t = this;
3586
3585
  //点/线旧数据
3587
3586
  var _t$state2 = t.state,
@@ -3635,7 +3634,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3635
3634
  isClearAll = nextProps.isClearAll,
3636
3635
  olProps = nextProps.olProps;
3637
3636
  // 等待地图加载
3638
- if (!t.state.mapCreated) return;
3637
+ if (!t.mapCreated) return;
3639
3638
  /*点数据处理
3640
3639
  pointData[2]相同的点,执行刷新
3641
3640
  pointData[1]的数据在idsForGraphicId中不存在的,执行新增
@@ -3924,7 +3923,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3924
3923
  }, {
3925
3924
  key: "getFeatureInfo",
3926
3925
  value: function getFeatureInfo(event, view, source) {
3927
- var _this8 = this;
3926
+ var _this9 = this;
3928
3927
  var sourceParam = source.getParams();
3929
3928
  var url = source.getFeatureInfoUrl(event.coordinate, view.getResolution(), view.getProjection(), {
3930
3929
  cql_filter: sourceParam === null || sourceParam === void 0 ? void 0 : sourceParam.cql_filter,
@@ -3954,7 +3953,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3954
3953
  if (data !== null && data !== void 0 && (_data$features = data.features) !== null && _data$features !== void 0 && _data$features.length) {
3955
3954
  features = geoJsonFormat.readFeatures(data);
3956
3955
  features.map(function (item) {
3957
- item.key = _this8 === null || _this8 === void 0 ? void 0 : _this8.key;
3956
+ item.key = _this9 === null || _this9 === void 0 ? void 0 : _this9.key;
3958
3957
  });
3959
3958
  }
3960
3959
  return features;
@@ -4188,16 +4187,16 @@ var Popup = /*#__PURE__*/function (_React$Component2) {
4188
4187
  _inherits(Popup, _React$Component2);
4189
4188
  var _super2 = _createSuper(Popup);
4190
4189
  function Popup(props) {
4191
- var _this9;
4190
+ var _this10;
4192
4191
  _classCallCheck(this, Popup);
4193
- _this9 = _super2.call(this);
4194
- _this9.map = props.map;
4195
- _this9.position = props.position;
4196
- _this9.overlay = null;
4197
- _this9.container = null;
4198
- _this9.innerHTML = props.innerHTML;
4199
- _this9.closeble = props.close;
4200
- return _this9;
4192
+ _this10 = _super2.call(this);
4193
+ _this10.map = props.map;
4194
+ _this10.position = props.position;
4195
+ _this10.overlay = null;
4196
+ _this10.container = null;
4197
+ _this10.innerHTML = props.innerHTML;
4198
+ _this10.closeble = props.close;
4199
+ return _this10;
4201
4200
  }
4202
4201
 
4203
4202
  // 弹出框