@vtx/map 1.1.11 → 1.1.14

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.
@@ -1,70 +1,70 @@
1
- .label-content{
2
- display: inline-block;
3
- padding: 5px;
4
- line-height: 22px;
5
- text-align: center;
6
- border-radius: 5px;
7
- background-color: #fff;
8
- opacity: 1;
9
- color: #5DD0EE;
10
- transform: translate(-50%);
11
- -ms-transform: translate(-50%);
12
- }
13
- .noselect {
14
- -webkit-touch-callout: none; /* iOS Safari */
15
- -webkit-user-select: none; /* Chrome/Safari/Opera */
16
- -khtml-user-select: none; /* Konqueror */
17
- -moz-user-select: none; /* Firefox */
18
- -ms-user-select: none; /* Internet Explorer/Edge */
19
- user-select: none; /* Non-prefixed version, currently
20
- not supported by any browser */
21
- }
22
- .vtx_gmap_html_pointCollection_a{
23
- position: absolute;
24
- canvas{
25
- z-index: 111;
26
- }
27
- }
28
- .vtx-g-rangingPoint{
29
- width: 8px;
30
- height: 8px;
31
- background-color: #fff;
32
- border: 2px solid #108ee9;
33
- display: inline-block;
34
- border-radius: 8px;
35
- position: relative;
36
- top: 5px;
37
- left: 1px;
38
- }
39
- .vtx-g-rangingDistance{
40
- position: relative;
41
- top: -36px;
42
- left: 15px;
43
- height: 30px;
44
- line-height: 28px;
45
- background-color: #fff;
46
- border: 1px solid #108ee9;
47
- font-size: 12px;
48
- word-break: keep-all;
49
- padding: 0px 3px;
50
- color: #108ee9;
51
- }
52
- .vtx-g-rang-exit{
53
- width: 12px;
54
- height: 12px;
55
- background-color: #fff;
56
- border: 2px solid #108ee9;
57
- color: #108ee9;
58
- line-height: 7px;
59
- text-align: center;
60
- font-size: 12px;
61
- cursor: pointer;
62
- }
63
- .vtx-g-rang-showRangTool{
64
- line-height: 18px;
65
- font-size: 12px;
66
- border: 1px solid #108ee9;
67
- word-break: keep-all;
68
- background-color: #fff;
69
- padding: 0px 5px;
70
- }
1
+ .label-content{
2
+ display: inline-block;
3
+ padding: 5px;
4
+ line-height: 22px;
5
+ text-align: center;
6
+ border-radius: 5px;
7
+ background-color: #fff;
8
+ opacity: 1;
9
+ color: #5DD0EE;
10
+ transform: translate(-50%);
11
+ -ms-transform: translate(-50%);
12
+ }
13
+ .noselect {
14
+ -webkit-touch-callout: none; /* iOS Safari */
15
+ -webkit-user-select: none; /* Chrome/Safari/Opera */
16
+ -khtml-user-select: none; /* Konqueror */
17
+ -moz-user-select: none; /* Firefox */
18
+ -ms-user-select: none; /* Internet Explorer/Edge */
19
+ user-select: none; /* Non-prefixed version, currently
20
+ not supported by any browser */
21
+ }
22
+ .vtx_gmap_html_pointCollection_a{
23
+ position: absolute;
24
+ canvas{
25
+ z-index: 111;
26
+ }
27
+ }
28
+ .vtx-g-rangingPoint{
29
+ width: 8px;
30
+ height: 8px;
31
+ background-color: #fff;
32
+ border: 2px solid #108ee9;
33
+ display: inline-block;
34
+ border-radius: 8px;
35
+ position: relative;
36
+ top: 5px;
37
+ left: 1px;
38
+ }
39
+ .vtx-g-rangingDistance{
40
+ position: relative;
41
+ top: -36px;
42
+ left: 15px;
43
+ height: 30px;
44
+ line-height: 28px;
45
+ background-color: #fff;
46
+ border: 1px solid #108ee9;
47
+ font-size: 12px;
48
+ word-break: keep-all;
49
+ padding: 0px 3px;
50
+ color: #108ee9;
51
+ }
52
+ .vtx-g-rang-exit{
53
+ width: 12px;
54
+ height: 12px;
55
+ background-color: #fff;
56
+ border: 2px solid #108ee9;
57
+ color: #108ee9;
58
+ line-height: 7px;
59
+ text-align: center;
60
+ font-size: 12px;
61
+ cursor: pointer;
62
+ }
63
+ .vtx-g-rang-showRangTool{
64
+ line-height: 18px;
65
+ font-size: 12px;
66
+ border: 1px solid #108ee9;
67
+ word-break: keep-all;
68
+ background-color: #fff;
69
+ padding: 0px 5px;
70
+ }
@@ -868,6 +868,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
868
868
  scale: drawParam.parameter.scale || 1
869
869
  })
870
870
  });
871
+ var geometryFunction;
871
872
 
872
873
  switch (drawParam.geometryType) {
873
874
  case 'point':
@@ -909,6 +910,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
909
910
  });
910
911
  break;
911
912
 
913
+ case 'rectangle':
914
+ type = 'Circle';
915
+ geometryFunction = ol.interaction.Draw.createBox();
916
+ break;
917
+
912
918
  case 'circle':
913
919
  type = 'Circle';
914
920
  style = new ol.style.Style({
@@ -927,7 +933,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
927
933
  if (!t.drawToolbar) {
928
934
  t.drawToolbar = new ol.interaction.Draw({
929
935
  source: t.drawSource,
930
- type: type // style: style
936
+ type: type,
937
+ geometryFunction: geometryFunction // style: style
931
938
 
932
939
  });
933
940
  gis.addInteraction(t.drawToolbar);
@@ -1056,14 +1063,42 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1056
1063
  };
1057
1064
  }
1058
1065
 
1059
- if (t.drawParam.geometryType == 'circle') {
1060
- var center = e.feature.getGeometry().getCenter(); // let radius = e.feature.getGeometry().getRadius();
1066
+ if (t.drawParam.geometryType == 'rectangle') {
1067
+ var _path3 = e.feature.getGeometry().getCoordinates()[0];
1068
+ t.addPolygon([{
1069
+ id: t.drawParam.data.id,
1070
+ rings: _path3,
1071
+ config: _objectSpread({}, t.drawParam.parameter)
1072
+ }], t.drawParam.geometryType); //处理线返回参数
1073
+
1074
+ var _t$dealData5 = t.dealData(_path3),
1075
+ _lnglatAry3 = _t$dealData5.lnglatAry,
1076
+ _extent4 = _t$dealData5._extent;
1061
1077
 
1062
- var sketchCoords_ = e.target.sketchCoords_[0];
1063
- var sketchCoords_2 = e.target.sketchCoords_[1];
1064
- var radius = ol.sphere.getDistance(sketchCoords_, sketchCoords_2); // let metersPerUnit = gis.getView().getProjection().getMetersPerUnit();
1065
- // let circleRadius = radius / metersPerUnit;
1078
+ param = {
1079
+ lnglatAry: _lnglatAry3,
1080
+ id: t.drawParam.data.id,
1081
+ geometry: _objectSpread(_objectSpread({}, e.geometry), {}, {
1082
+ rings: _path3,
1083
+ type: t.drawParam.geometryType,
1084
+ _extent: _extent4
1085
+ }),
1086
+ attributes: {
1087
+ id: t.drawParam.data.id,
1088
+ config: _objectSpread({}, t.drawParam.parameter)
1089
+ },
1090
+ area: (0, _MapToolFunction.getPolygonArea)(_path3),
1091
+ geometryType: t.drawParam.geometryType,
1092
+ mapLayer: t.GM.getGraphic(t.drawParam.data.id)
1093
+ };
1094
+ }
1066
1095
 
1096
+ if (t.drawParam.geometryType == 'circle') {
1097
+ var center = e.feature.getGeometry().getCenter();
1098
+ var cur = e.feature.getProperties().geometry;
1099
+ var sketchCoords_ = [cur.flatCoordinates[0], cur.flatCoordinates[1]];
1100
+ var sketchCoords_2 = [cur.flatCoordinates[2], cur.flatCoordinates[3]];
1101
+ var radius = ol.sphere.getDistance(sketchCoords_, sketchCoords_2);
1067
1102
  t.addCircle([{
1068
1103
  id: t.drawParam.data.id,
1069
1104
  longitude: center[0],
@@ -1337,10 +1372,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1337
1372
  }
1338
1373
  } //将制定图元展示在视野内 (强制改变地图中心位置)
1339
1374
 
1340
- /*
1341
- 参数arg格式如下1,2
1342
- 1.string 格式如:'1,a,2,3,4'
1343
- 2.数组 ['1','2']
1375
+ /*
1376
+ 参数arg格式如下1,2
1377
+ 1.string 格式如:'1,a,2,3,4'
1378
+ 2.数组 ['1','2']
1344
1379
  */
1345
1380
 
1346
1381
  }, {
@@ -1663,12 +1698,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
1663
1698
  item.value.clear();
1664
1699
  });
1665
1700
  }
1666
- /*
1667
- * 添加信息窗口
1668
- * params
1669
- * @position: Array[longitude,latitude]
1670
- * @content: String|HTML
1671
- * @close: boolean
1701
+ /*
1702
+ * 添加信息窗口
1703
+ * params
1704
+ * @position: Array[longitude,latitude]
1705
+ * @content: String|HTML
1706
+ * @close: boolean
1672
1707
  */
1673
1708
 
1674
1709
  }, {
@@ -2719,8 +2754,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2719
2754
  value: function setAreaRestriction(areaRestriction) {
2720
2755
  var t = this;
2721
2756
 
2722
- var _t$dealData5 = t.dealData(areaRestriction),
2723
- _et = _t$dealData5._extent;
2757
+ var _t$dealData6 = t.dealData(areaRestriction),
2758
+ _et = _t$dealData6._extent;
2724
2759
 
2725
2760
  t.areaRestriction = t.state.gis.getView().setProperties({
2726
2761
  extent: [_et.xmax, _et.ymax, _et.xmin, _et.ymin]
@@ -2817,7 +2852,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
2817
2852
 
2818
2853
  function clusterMemberStyle(clusterMember) {
2819
2854
  var style = clusterMember.getStyle();
2820
- var image = style.getImage();
2855
+ var image = style && style.getImage ? style.getImage() : null;
2821
2856
  return new ol.style.Style({
2822
2857
  geometry: clusterMember.getGeometry(),
2823
2858
  image: image
@@ -3445,10 +3480,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3445
3480
  isClearAll = nextProps.isClearAll; // 等待地图加载
3446
3481
 
3447
3482
  if (!t.state.mapCreated) return;
3448
- /*点数据处理
3449
- pointData[2]相同的点,执行刷新
3450
- pointData[1]的数据在idsForGraphicId中不存在的,执行新增
3451
- pointData[0]数据中多余的id,执行删除
3483
+ /*点数据处理
3484
+ pointData[2]相同的点,执行刷新
3485
+ pointData[1]的数据在idsForGraphicId中不存在的,执行新增
3486
+ pointData[0]数据中多余的id,执行删除
3452
3487
  */
3453
3488
 
3454
3489
  if (mapPoints instanceof Array && t.props.mapPoints instanceof Array && !t.deepEqual(mapPoints, t.props.mapPoints)) {
@@ -3497,9 +3532,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3497
3532
 
3498
3533
  t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
3499
3534
  }
3500
- /*
3501
- 线数据处理
3502
- 先全删除,再新增
3535
+ /*
3536
+ 线数据处理
3537
+ 先全删除,再新增
3503
3538
  */
3504
3539
 
3505
3540
 
@@ -3549,9 +3584,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3549
3584
 
3550
3585
  t.updateLine([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
3551
3586
  }
3552
- /*
3553
- 面数据处理
3554
- 先全删除,再新增
3587
+ /*
3588
+ 面数据处理
3589
+ 先全删除,再新增
3555
3590
  */
3556
3591
 
3557
3592
 
@@ -3601,9 +3636,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3601
3636
 
3602
3637
  t.updatePolygon([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
3603
3638
  }
3604
- /*
3605
- 圆数据处理
3606
- 先全删除,再新增
3639
+ /*
3640
+ 圆数据处理
3641
+ 先全删除,再新增
3607
3642
  */
3608
3643
 
3609
3644
 
@@ -3747,12 +3782,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
3747
3782
  var obj = t.getMapExtent();
3748
3783
  obj.e = e;
3749
3784
  obj.clickLngLat = {
3750
- lng: (e.mapPoint || {}).x,
3751
- lat: (e.mapPoint || {}).y
3785
+ lng: e.coordinate ? e.coordinate[0] : undefined,
3786
+ lat: e.coordinate ? e.coordinate[1] : undefined
3752
3787
  };
3753
3788
  obj.pixel = {
3754
- x: (e.screenPoint || {}).x,
3755
- y: (e.screenPoint || {}).y
3789
+ x: e.pixel ? e.pixel[0] : undefined,
3790
+ y: e.pixel ? e.pixel[1] : undefined
3756
3791
  };
3757
3792
  t.props.clickMap(obj);
3758
3793
  }