@vtx/map 1.1.23 → 1.1.25
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/README.md +44 -44
- package/lib/VtxMap/BMap/Map.js +12 -3
- package/lib/VtxMap/BMap/Map.js.map +1 -1
- package/lib/VtxMap/OMap/Map.js +43 -43
- package/lib/VtxMap/OMap/Map.js.map +1 -1
- package/lib/VtxMap/OMap/Map.less +70 -70
- package/lib/VtxMap/OlMap/Map.js +380 -320
- package/lib/VtxMap/OlMap/Map.js.map +1 -1
- package/lib/VtxMap/OlMap/Map.less +230 -230
- package/lib/VtxMap/TMap/TMap.js +20 -19
- package/lib/VtxMap/TMap/TMap.js.map +1 -1
- package/lib/VtxSearchCheckMap/index.js.map +1 -1
- package/lib/VtxSearchCheckMap/mapping.js.map +1 -1
- package/lib/VtxSearchMap/VtxSearchMap.js +24 -12
- package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
- package/lib/VtxSearchMap/index.js.map +1 -1
- package/lib/VtxSearchMap/mapping.js.map +1 -1
- package/package.json +1 -1
package/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -744,26 +744,39 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
744
744
|
source: gp.source
|
|
745
745
|
});
|
|
746
746
|
t.state.gis.addInteraction(t.editToolbar);
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
feature = feature;
|
|
751
|
-
}); //返回参数
|
|
747
|
+
} else {
|
|
748
|
+
t.state.gis.addInteraction(t.editToolbar);
|
|
749
|
+
}
|
|
752
750
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
751
|
+
t.editToolbar.on('modifyend', function (e) {
|
|
752
|
+
var feature = gc;
|
|
753
|
+
e.features.forEach(function (feature) {
|
|
754
|
+
feature = feature;
|
|
755
|
+
}); //返回参数
|
|
756
|
+
|
|
757
|
+
var param = {
|
|
758
|
+
id: id,
|
|
759
|
+
e: e
|
|
760
|
+
}; // 绘制内部管理的图元
|
|
757
761
|
|
|
758
|
-
|
|
759
|
-
|
|
762
|
+
if (gp.geometry.type == 'point') {
|
|
763
|
+
var cur = feature.getProperties().geometry;
|
|
760
764
|
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
765
|
+
var _cur$flatCoordinates = _slicedToArray(cur.flatCoordinates, 2),
|
|
766
|
+
lng = _cur$flatCoordinates[0],
|
|
767
|
+
lat = _cur$flatCoordinates[1]; //处理点返回参数
|
|
764
768
|
|
|
765
769
|
|
|
766
|
-
|
|
770
|
+
param = _objectSpread(_objectSpread({}, param), {}, {
|
|
771
|
+
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
772
|
+
longitude: lng,
|
|
773
|
+
latitude: lat,
|
|
774
|
+
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
775
|
+
longitude: lng,
|
|
776
|
+
latitude: lat
|
|
777
|
+
})
|
|
778
|
+
}),
|
|
779
|
+
param: {
|
|
767
780
|
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
768
781
|
longitude: lng,
|
|
769
782
|
latitude: lat,
|
|
@@ -772,149 +785,151 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
772
785
|
latitude: lat
|
|
773
786
|
})
|
|
774
787
|
}),
|
|
775
|
-
param: {
|
|
776
|
-
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
777
|
-
longitude: lng,
|
|
778
|
-
latitude: lat,
|
|
779
|
-
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
780
|
-
longitude: lng,
|
|
781
|
-
latitude: lat
|
|
782
|
-
})
|
|
783
|
-
}),
|
|
784
|
-
geometryType: gp.geometry.type,
|
|
785
|
-
mapLayer: t.GM.getGraphic(id)
|
|
786
|
-
},
|
|
787
788
|
geometryType: gp.geometry.type,
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
789
|
+
mapLayer: t.GM.getGraphic(id)
|
|
790
|
+
},
|
|
791
|
+
geometryType: gp.geometry.type,
|
|
792
|
+
geometry: {
|
|
793
|
+
type: 'point',
|
|
794
|
+
x: lng,
|
|
795
|
+
y: lat
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
} //线
|
|
795
799
|
|
|
796
800
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
+
if (gp.geometry.type == 'polyline') {
|
|
802
|
+
var _cur = feature.getProperties().geometry;
|
|
803
|
+
var oddList = [],
|
|
804
|
+
evenList = [];
|
|
801
805
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
806
|
+
_cur.flatCoordinates.map(function (item, index) {
|
|
807
|
+
// 判断下标奇偶数
|
|
808
|
+
if (index % 2 === 0) {
|
|
809
|
+
evenList.push(item);
|
|
810
|
+
} else {
|
|
811
|
+
oddList.push(item);
|
|
812
|
+
}
|
|
813
|
+
});
|
|
810
814
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
815
|
+
var path = oddList.map(function (item, index) {
|
|
816
|
+
return [evenList[index], oddList[index]];
|
|
817
|
+
}); //处理线返回参数
|
|
814
818
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
819
|
+
var _t$dealData = t.dealData(path),
|
|
820
|
+
lnglatAry = _t$dealData.lnglatAry,
|
|
821
|
+
_extent = _t$dealData._extent;
|
|
818
822
|
|
|
819
|
-
|
|
823
|
+
param = _objectSpread(_objectSpread({}, param), {}, {
|
|
824
|
+
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
825
|
+
paths: path,
|
|
826
|
+
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
827
|
+
paths: path
|
|
828
|
+
})
|
|
829
|
+
}),
|
|
830
|
+
param: {
|
|
820
831
|
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
821
832
|
paths: path,
|
|
822
833
|
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
823
834
|
paths: path
|
|
824
835
|
})
|
|
825
836
|
}),
|
|
826
|
-
param: {
|
|
827
|
-
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
828
|
-
paths: path,
|
|
829
|
-
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
830
|
-
paths: path
|
|
831
|
-
})
|
|
832
|
-
}),
|
|
833
|
-
geometry: {
|
|
834
|
-
paths: path,
|
|
835
|
-
_extent: _extent,
|
|
836
|
-
type: "polyline"
|
|
837
|
-
},
|
|
838
|
-
geometryType: 'polyline',
|
|
839
|
-
lnglatAry: lnglatAry,
|
|
840
|
-
mapLayer: t.GM.getGraphic(id)
|
|
841
|
-
},
|
|
842
|
-
geometryType: gp.geometry.type,
|
|
843
837
|
geometry: {
|
|
844
838
|
paths: path,
|
|
845
839
|
_extent: _extent,
|
|
846
840
|
type: "polyline"
|
|
847
841
|
},
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
842
|
+
geometryType: 'polyline',
|
|
843
|
+
lnglatAry: lnglatAry,
|
|
844
|
+
mapLayer: t.GM.getGraphic(id)
|
|
845
|
+
},
|
|
846
|
+
geometryType: gp.geometry.type,
|
|
847
|
+
geometry: {
|
|
848
|
+
paths: path,
|
|
849
|
+
_extent: _extent,
|
|
850
|
+
type: "polyline"
|
|
851
|
+
},
|
|
852
|
+
distance: t.calculateDistance(path)
|
|
853
|
+
});
|
|
854
|
+
} //面
|
|
851
855
|
|
|
852
856
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
+
if (gp.geometry.type == 'polygon') {
|
|
858
|
+
var _cur2 = feature.getProperties().geometry;
|
|
859
|
+
var _oddList = [],
|
|
860
|
+
_evenList = [];
|
|
857
861
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
862
|
+
_cur2.flatCoordinates.map(function (item, index) {
|
|
863
|
+
// 判断下标奇偶数
|
|
864
|
+
if (index % 2 === 0) {
|
|
865
|
+
_evenList.push(item);
|
|
866
|
+
} else {
|
|
867
|
+
_oddList.push(item);
|
|
868
|
+
}
|
|
869
|
+
});
|
|
866
870
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
871
|
+
var _path = _oddList.map(function (item, index) {
|
|
872
|
+
return [_evenList[index], _oddList[index]];
|
|
873
|
+
}); //处理线返回参数
|
|
870
874
|
|
|
871
875
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
876
|
+
var _t$dealData2 = t.dealData(_path),
|
|
877
|
+
_lnglatAry = _t$dealData2.lnglatAry,
|
|
878
|
+
_extent2 = _t$dealData2._extent;
|
|
875
879
|
|
|
876
|
-
|
|
880
|
+
param = _objectSpread(_objectSpread({}, param), {}, {
|
|
881
|
+
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
882
|
+
rings: _path,
|
|
883
|
+
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
884
|
+
paths: _path
|
|
885
|
+
})
|
|
886
|
+
}),
|
|
887
|
+
param: {
|
|
877
888
|
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
878
889
|
rings: _path,
|
|
879
890
|
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
880
891
|
paths: _path
|
|
881
892
|
})
|
|
882
893
|
}),
|
|
883
|
-
param: {
|
|
884
|
-
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
885
|
-
rings: _path,
|
|
886
|
-
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
887
|
-
paths: _path
|
|
888
|
-
})
|
|
889
|
-
}),
|
|
890
|
-
geometry: {
|
|
891
|
-
rings: _path,
|
|
892
|
-
type: 'polygon',
|
|
893
|
-
_extent: _extent2
|
|
894
|
-
},
|
|
895
|
-
geometryType: 'polygon',
|
|
896
|
-
lnglatAry: _lnglatAry,
|
|
897
|
-
mapLayer: t.GM.getGraphic(id)
|
|
898
|
-
},
|
|
899
|
-
geometryType: gp.geometry.type,
|
|
900
894
|
geometry: {
|
|
901
895
|
rings: _path,
|
|
902
896
|
type: 'polygon',
|
|
903
897
|
_extent: _extent2
|
|
904
898
|
},
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
899
|
+
geometryType: 'polygon',
|
|
900
|
+
lnglatAry: _lnglatAry,
|
|
901
|
+
mapLayer: t.GM.getGraphic(id)
|
|
902
|
+
},
|
|
903
|
+
geometryType: gp.geometry.type,
|
|
904
|
+
geometry: {
|
|
905
|
+
rings: _path,
|
|
906
|
+
type: 'polygon',
|
|
907
|
+
_extent: _extent2
|
|
908
|
+
},
|
|
909
|
+
area: (0, _MapToolFunction.getPolygonArea)(_path)
|
|
910
|
+
});
|
|
911
|
+
}
|
|
908
912
|
|
|
909
|
-
|
|
910
|
-
|
|
913
|
+
if (gp.geometry.type == 'circle') {
|
|
914
|
+
var _cur3 = feature.getProperties().geometry;
|
|
911
915
|
|
|
912
|
-
|
|
916
|
+
var center = _cur3.getCenter();
|
|
913
917
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
+
var sketchCoords_ = [_cur3.flatCoordinates[0], _cur3.flatCoordinates[1]];
|
|
919
|
+
var sketchCoords_2 = [_cur3.flatCoordinates[2], _cur3.flatCoordinates[3]];
|
|
920
|
+
var radius = ol.sphere.getDistance(sketchCoords_, sketchCoords_2);
|
|
921
|
+
param = _objectSpread(_objectSpread({}, param), {}, {
|
|
922
|
+
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
923
|
+
longitude: center[0],
|
|
924
|
+
latitude: center[1],
|
|
925
|
+
radius: radius,
|
|
926
|
+
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
927
|
+
longitude: center[0],
|
|
928
|
+
latitude: center[1],
|
|
929
|
+
radius: radius
|
|
930
|
+
})
|
|
931
|
+
}),
|
|
932
|
+
param: {
|
|
918
933
|
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
919
934
|
longitude: center[0],
|
|
920
935
|
latitude: center[1],
|
|
@@ -925,47 +940,34 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
925
940
|
radius: radius
|
|
926
941
|
})
|
|
927
942
|
}),
|
|
928
|
-
param: {
|
|
929
|
-
attributes: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
930
|
-
longitude: center[0],
|
|
931
|
-
latitude: center[1],
|
|
932
|
-
radius: radius,
|
|
933
|
-
other: _objectSpread(_objectSpread({}, gp.attributes), {}, {
|
|
934
|
-
longitude: center[0],
|
|
935
|
-
latitude: center[1],
|
|
936
|
-
radius: radius
|
|
937
|
-
})
|
|
938
|
-
}),
|
|
939
|
-
geometry: {
|
|
940
|
-
x: center[0],
|
|
941
|
-
y: center[1],
|
|
942
|
-
radius: radius,
|
|
943
|
-
type: 'circle'
|
|
944
|
-
},
|
|
945
|
-
geometryType: 'circle',
|
|
946
|
-
mapLayer: t.GM.getGraphic(id)
|
|
947
|
-
},
|
|
948
|
-
geometryType: gp.geometry.type,
|
|
949
|
-
area: Math.PI * Math.pow(radius, 2),
|
|
950
943
|
geometry: {
|
|
951
|
-
type: 'circle',
|
|
952
944
|
x: center[0],
|
|
953
945
|
y: center[1],
|
|
954
|
-
radius: radius
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
946
|
+
radius: radius,
|
|
947
|
+
type: 'circle'
|
|
948
|
+
},
|
|
949
|
+
geometryType: 'circle',
|
|
950
|
+
mapLayer: t.GM.getGraphic(id)
|
|
951
|
+
},
|
|
952
|
+
geometryType: gp.geometry.type,
|
|
953
|
+
area: Math.PI * Math.pow(radius, 2),
|
|
954
|
+
geometry: {
|
|
955
|
+
type: 'circle',
|
|
956
|
+
x: center[0],
|
|
957
|
+
y: center[1],
|
|
958
|
+
radius: radius
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
962
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
});
|
|
967
|
-
}
|
|
963
|
+
if ('editGraphicChange' in t.props && typeof t.props.editGraphicChange == 'function') {
|
|
964
|
+
t.props.editGraphicChange(param);
|
|
965
|
+
}
|
|
968
966
|
|
|
967
|
+
t.GM.setGraphic(id, feature).setGraphicParam(id, _objectSpread(_objectSpread({}, param), {}, {
|
|
968
|
+
source: gp.source
|
|
969
|
+
}));
|
|
970
|
+
});
|
|
969
971
|
t.editId = id;
|
|
970
972
|
} //关闭编辑
|
|
971
973
|
|
|
@@ -1089,169 +1091,224 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1089
1091
|
|
|
1090
1092
|
});
|
|
1091
1093
|
gis.addInteraction(t.drawToolbar);
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1094
|
+
} else {
|
|
1095
|
+
gis.addInteraction(t.drawToolbar);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
t.drawToolbar.on('drawend', function (e) {
|
|
1099
|
+
// 关闭绘制事件
|
|
1100
|
+
t.drawToolbar.finishDrawing(); // 移除
|
|
1101
|
+
|
|
1102
|
+
gis.removeInteraction(t.drawToolbar);
|
|
1103
|
+
var gc = e.feature.getGeometry(); //返回参数
|
|
1095
1104
|
|
|
1096
|
-
|
|
1097
|
-
var gc = e.feature.getGeometry(); //返回参数
|
|
1105
|
+
var param = {}; // 绘制内部管理的图元
|
|
1098
1106
|
|
|
1099
|
-
|
|
1107
|
+
if (t.drawParam.geometryType == 'point') {
|
|
1108
|
+
var _gc$flatCoordinates = _slicedToArray(gc.flatCoordinates, 2),
|
|
1109
|
+
lng = _gc$flatCoordinates[0],
|
|
1110
|
+
lat = _gc$flatCoordinates[1];
|
|
1100
1111
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
lng = _gc$flatCoordinates[0],
|
|
1104
|
-
lat = _gc$flatCoordinates[1];
|
|
1112
|
+
gc.x = lng;
|
|
1113
|
+
gc.y = lat;
|
|
1105
1114
|
|
|
1106
|
-
|
|
1107
|
-
|
|
1115
|
+
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1116
|
+
t.updatePoint([{
|
|
1117
|
+
id: t.drawParam.data.id,
|
|
1118
|
+
longitude: lng,
|
|
1119
|
+
latitude: lat,
|
|
1120
|
+
url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1121
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1122
|
+
}], "point");
|
|
1123
|
+
} else {
|
|
1108
1124
|
t.addPoint([{
|
|
1109
1125
|
id: t.drawParam.data.id,
|
|
1110
1126
|
longitude: lng,
|
|
1111
1127
|
latitude: lat,
|
|
1112
1128
|
url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1113
1129
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1114
|
-
}], 'point');
|
|
1130
|
+
}], 'point');
|
|
1131
|
+
} //处理点返回参数
|
|
1132
|
+
|
|
1115
1133
|
|
|
1116
|
-
|
|
1134
|
+
param = {
|
|
1135
|
+
id: t.drawParam.data.id,
|
|
1136
|
+
attributes: {
|
|
1117
1137
|
id: t.drawParam.data.id,
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
};
|
|
1130
|
-
} //线
|
|
1138
|
+
url: t.drawParam.parameter.url || require("../images/defaultMarker.png"),
|
|
1139
|
+
config: {
|
|
1140
|
+
width: t.drawParam.parameter.width || 30,
|
|
1141
|
+
height: t.drawParam.parameter.height || 30
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
geometry: gc,
|
|
1145
|
+
geometryType: 'point',
|
|
1146
|
+
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1147
|
+
};
|
|
1148
|
+
} //线
|
|
1131
1149
|
|
|
1132
1150
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1151
|
+
if (t.drawParam.geometryType == 'polyline') {
|
|
1152
|
+
var oddList = [],
|
|
1153
|
+
evenList = [];
|
|
1154
|
+
gc.flatCoordinates.map(function (item, index) {
|
|
1155
|
+
// 判断下标奇偶数
|
|
1156
|
+
if (index % 2 === 0) {
|
|
1157
|
+
evenList.push(item);
|
|
1158
|
+
} else {
|
|
1159
|
+
oddList.push(item);
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
var path = oddList.map(function (item, index) {
|
|
1163
|
+
return [evenList[index], oddList[index]];
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1167
|
+
t.updateLine([{
|
|
1168
|
+
id: t.drawParam.data.id,
|
|
1169
|
+
paths: path,
|
|
1170
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1171
|
+
}], 'polyline');
|
|
1172
|
+
} else {
|
|
1147
1173
|
t.addLine([{
|
|
1148
1174
|
id: t.drawParam.data.id,
|
|
1149
1175
|
paths: path,
|
|
1150
1176
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1151
|
-
}], 'polyline');
|
|
1177
|
+
}], 'polyline');
|
|
1178
|
+
} //处理线返回参数
|
|
1152
1179
|
|
|
1153
|
-
var _t$dealData3 = t.dealData(path),
|
|
1154
|
-
lnglatAry = _t$dealData3.lnglatAry,
|
|
1155
|
-
_extent = _t$dealData3._extent;
|
|
1156
1180
|
|
|
1157
|
-
|
|
1158
|
-
lnglatAry
|
|
1181
|
+
var _t$dealData3 = t.dealData(path),
|
|
1182
|
+
lnglatAry = _t$dealData3.lnglatAry,
|
|
1183
|
+
_extent = _t$dealData3._extent;
|
|
1184
|
+
|
|
1185
|
+
param = {
|
|
1186
|
+
lnglatAry: lnglatAry,
|
|
1187
|
+
id: t.drawParam.data.id,
|
|
1188
|
+
geometry: _objectSpread(_objectSpread({}, e.geometry), {}, {
|
|
1189
|
+
paths: path,
|
|
1190
|
+
_extent: _extent
|
|
1191
|
+
}),
|
|
1192
|
+
attributes: {
|
|
1159
1193
|
id: t.drawParam.data.id,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
},
|
|
1168
|
-
distance: t.calculateDistance(path),
|
|
1169
|
-
geometryType: 'polyline',
|
|
1170
|
-
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1171
|
-
};
|
|
1172
|
-
} //面
|
|
1194
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1195
|
+
},
|
|
1196
|
+
distance: t.calculateDistance(path),
|
|
1197
|
+
geometryType: 'polyline',
|
|
1198
|
+
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1199
|
+
};
|
|
1200
|
+
} //面
|
|
1173
1201
|
|
|
1174
1202
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1203
|
+
if (t.drawParam.geometryType == 'polygon') {
|
|
1204
|
+
var _oddList2 = [],
|
|
1205
|
+
_evenList2 = [];
|
|
1206
|
+
gc.flatCoordinates.map(function (item, index) {
|
|
1207
|
+
// 判断下标奇偶数
|
|
1208
|
+
if (index % 2 === 0) {
|
|
1209
|
+
_evenList2.push(item);
|
|
1210
|
+
} else {
|
|
1211
|
+
_oddList2.push(item);
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1186
1214
|
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1215
|
+
var _path2 = _oddList2.map(function (item, index) {
|
|
1216
|
+
return [_evenList2[index], _oddList2[index]];
|
|
1217
|
+
});
|
|
1190
1218
|
|
|
1219
|
+
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1220
|
+
t.updatePolygon([{
|
|
1221
|
+
id: t.drawParam.data.id,
|
|
1222
|
+
rings: _path2,
|
|
1223
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1224
|
+
}], t.drawParam.geometryType);
|
|
1225
|
+
} else {
|
|
1191
1226
|
t.addPolygon([{
|
|
1192
1227
|
id: t.drawParam.data.id,
|
|
1193
1228
|
rings: _path2,
|
|
1194
1229
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1195
|
-
}], t.drawParam.geometryType);
|
|
1230
|
+
}], t.drawParam.geometryType);
|
|
1231
|
+
} //处理线返回参数
|
|
1232
|
+
|
|
1196
1233
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1234
|
+
var _t$dealData4 = t.dealData(_path2),
|
|
1235
|
+
_lnglatAry2 = _t$dealData4.lnglatAry,
|
|
1236
|
+
_extent3 = _t$dealData4._extent;
|
|
1200
1237
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1238
|
+
param = {
|
|
1239
|
+
lnglatAry: _lnglatAry2,
|
|
1240
|
+
id: t.drawParam.data.id,
|
|
1241
|
+
geometry: _objectSpread(_objectSpread({}, e.geometry), {}, {
|
|
1242
|
+
rings: _path2,
|
|
1243
|
+
type: t.drawParam.geometryType,
|
|
1244
|
+
_extent: _extent3
|
|
1245
|
+
}),
|
|
1246
|
+
attributes: {
|
|
1203
1247
|
id: t.drawParam.data.id,
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
config: _objectSpread({}, t.drawParam.parameter)
|
|
1212
|
-
},
|
|
1213
|
-
area: (0, _MapToolFunction.getPolygonArea)(_path2),
|
|
1214
|
-
geometryType: t.drawParam.geometryType,
|
|
1215
|
-
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1248
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1249
|
+
},
|
|
1250
|
+
area: (0, _MapToolFunction.getPolygonArea)(_path2),
|
|
1251
|
+
geometryType: t.drawParam.geometryType,
|
|
1252
|
+
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1218
1255
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1256
|
+
if (t.drawParam.geometryType == 'rectangle') {
|
|
1257
|
+
var _path3 = e.feature.getGeometry().getCoordinates()[0];
|
|
1258
|
+
|
|
1259
|
+
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1260
|
+
t.updatePolygon([{
|
|
1261
|
+
id: t.drawParam.data.id,
|
|
1262
|
+
rings: _path3,
|
|
1263
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1264
|
+
}], t.drawParam.geometryType);
|
|
1265
|
+
} else {
|
|
1221
1266
|
t.addPolygon([{
|
|
1222
1267
|
id: t.drawParam.data.id,
|
|
1223
1268
|
rings: _path3,
|
|
1224
1269
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1225
|
-
}], t.drawParam.geometryType);
|
|
1270
|
+
}], t.drawParam.geometryType);
|
|
1271
|
+
} //处理线返回参数
|
|
1226
1272
|
|
|
1227
|
-
var _t$dealData5 = t.dealData(_path3),
|
|
1228
|
-
_lnglatAry3 = _t$dealData5.lnglatAry,
|
|
1229
|
-
_extent4 = _t$dealData5._extent;
|
|
1230
1273
|
|
|
1231
|
-
|
|
1232
|
-
lnglatAry
|
|
1274
|
+
var _t$dealData5 = t.dealData(_path3),
|
|
1275
|
+
_lnglatAry3 = _t$dealData5.lnglatAry,
|
|
1276
|
+
_extent4 = _t$dealData5._extent;
|
|
1277
|
+
|
|
1278
|
+
param = {
|
|
1279
|
+
lnglatAry: _lnglatAry3,
|
|
1280
|
+
id: t.drawParam.data.id,
|
|
1281
|
+
geometry: _objectSpread(_objectSpread({}, e.geometry), {}, {
|
|
1282
|
+
rings: _path3,
|
|
1283
|
+
type: t.drawParam.geometryType,
|
|
1284
|
+
_extent: _extent4
|
|
1285
|
+
}),
|
|
1286
|
+
attributes: {
|
|
1233
1287
|
id: t.drawParam.data.id,
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1288
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1289
|
+
},
|
|
1290
|
+
area: (0, _MapToolFunction.getPolygonArea)(_path3),
|
|
1291
|
+
geometryType: t.drawParam.geometryType,
|
|
1292
|
+
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
if (t.drawParam.geometryType == 'circle') {
|
|
1297
|
+
var center = e.feature.getGeometry().getCenter();
|
|
1298
|
+
var cur = e.feature.getProperties().geometry;
|
|
1299
|
+
var sketchCoords_ = [cur.flatCoordinates[0], cur.flatCoordinates[1]];
|
|
1300
|
+
var sketchCoords_2 = [cur.flatCoordinates[2], cur.flatCoordinates[3]];
|
|
1301
|
+
var radius = ol.sphere.getDistance(sketchCoords_, sketchCoords_2);
|
|
1248
1302
|
|
|
1249
|
-
if (t.drawParam.
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1303
|
+
if (t.GM.isRepetition(t.drawParam.data.id)) {
|
|
1304
|
+
t.updateCircle([{
|
|
1305
|
+
id: t.drawParam.data.id,
|
|
1306
|
+
longitude: center[0],
|
|
1307
|
+
latitude: center[1],
|
|
1308
|
+
radius: radius,
|
|
1309
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1310
|
+
}], t.drawParam.geometryType);
|
|
1311
|
+
} else {
|
|
1255
1312
|
t.addCircle([{
|
|
1256
1313
|
id: t.drawParam.data.id,
|
|
1257
1314
|
longitude: center[0],
|
|
@@ -1259,28 +1316,31 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1259
1316
|
radius: radius,
|
|
1260
1317
|
config: _objectSpread({}, t.drawParam.parameter)
|
|
1261
1318
|
}], t.drawParam.geometryType);
|
|
1262
|
-
param = {
|
|
1263
|
-
area: Math.PI * Math.pow(radius, 2),
|
|
1264
|
-
attributes: {
|
|
1265
|
-
id: t.drawParam.data.id,
|
|
1266
|
-
config: _objectSpread({}, t.drawParam.parameter)
|
|
1267
|
-
},
|
|
1268
|
-
geometry: {
|
|
1269
|
-
type: t.drawParam.geometryType,
|
|
1270
|
-
x: center[0],
|
|
1271
|
-
y: center[1],
|
|
1272
|
-
radius: radius
|
|
1273
|
-
},
|
|
1274
|
-
geometryType: t.drawParam.geometryType,
|
|
1275
|
-
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1276
|
-
};
|
|
1277
1319
|
}
|
|
1278
1320
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1321
|
+
param = {
|
|
1322
|
+
area: Math.PI * Math.pow(radius, 2),
|
|
1323
|
+
attributes: {
|
|
1324
|
+
id: t.drawParam.data.id,
|
|
1325
|
+
config: _objectSpread({}, t.drawParam.parameter)
|
|
1326
|
+
},
|
|
1327
|
+
geometry: {
|
|
1328
|
+
type: t.drawParam.geometryType,
|
|
1329
|
+
x: center[0],
|
|
1330
|
+
y: center[1],
|
|
1331
|
+
radius: radius
|
|
1332
|
+
},
|
|
1333
|
+
geometryType: t.drawParam.geometryType,
|
|
1334
|
+
mapLayer: t.GM.getGraphic(t.drawParam.data.id)
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
if ('drawEnd' in t.props && typeof t.props.drawEnd == 'function') {
|
|
1339
|
+
t.props.drawEnd(param);
|
|
1340
|
+
}
|
|
1341
|
+
}); //保存绘制图元的id便于后期比对
|
|
1342
|
+
|
|
1343
|
+
t.state.drawIds[drawParam.geometryType].push(drawParam.data.id);
|
|
1284
1344
|
} // 关闭绘制
|
|
1285
1345
|
|
|
1286
1346
|
}, {
|
|
@@ -1525,10 +1585,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1525
1585
|
}
|
|
1526
1586
|
} //将制定图元展示在视野内 (强制改变地图中心位置)
|
|
1527
1587
|
|
|
1528
|
-
/*
|
|
1529
|
-
参数arg格式如下1,2
|
|
1530
|
-
1.string 格式如:'1,a,2,3,4'
|
|
1531
|
-
2.数组 ['1','2']
|
|
1588
|
+
/*
|
|
1589
|
+
参数arg格式如下1,2
|
|
1590
|
+
1.string 格式如:'1,a,2,3,4'
|
|
1591
|
+
2.数组 ['1','2']
|
|
1532
1592
|
*/
|
|
1533
1593
|
|
|
1534
1594
|
}, {
|
|
@@ -1851,12 +1911,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1851
1911
|
item.value.clear();
|
|
1852
1912
|
});
|
|
1853
1913
|
}
|
|
1854
|
-
/*
|
|
1855
|
-
* 添加信息窗口
|
|
1856
|
-
* params
|
|
1857
|
-
* @position: Array[longitude,latitude]
|
|
1858
|
-
* @content: String|HTML
|
|
1859
|
-
* @close: boolean
|
|
1914
|
+
/*
|
|
1915
|
+
* 添加信息窗口
|
|
1916
|
+
* params
|
|
1917
|
+
* @position: Array[longitude,latitude]
|
|
1918
|
+
* @content: String|HTML
|
|
1919
|
+
* @close: boolean
|
|
1860
1920
|
*/
|
|
1861
1921
|
|
|
1862
1922
|
}, {
|
|
@@ -3703,10 +3763,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3703
3763
|
olProps = nextProps.olProps; // 等待地图加载
|
|
3704
3764
|
|
|
3705
3765
|
if (!t.state.mapCreated) return;
|
|
3706
|
-
/*点数据处理
|
|
3707
|
-
pointData[2]相同的点,执行刷新
|
|
3708
|
-
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
3709
|
-
pointData[0]数据中多余的id,执行删除
|
|
3766
|
+
/*点数据处理
|
|
3767
|
+
pointData[2]相同的点,执行刷新
|
|
3768
|
+
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
3769
|
+
pointData[0]数据中多余的id,执行删除
|
|
3710
3770
|
*/
|
|
3711
3771
|
|
|
3712
3772
|
if (mapPoints instanceof Array && t.props.mapPoints instanceof Array && !t.deepEqual(mapPoints, t.props.mapPoints)) {
|
|
@@ -3755,9 +3815,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3755
3815
|
|
|
3756
3816
|
t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
|
|
3757
3817
|
}
|
|
3758
|
-
/*
|
|
3759
|
-
线数据处理
|
|
3760
|
-
先全删除,再新增
|
|
3818
|
+
/*
|
|
3819
|
+
线数据处理
|
|
3820
|
+
先全删除,再新增
|
|
3761
3821
|
*/
|
|
3762
3822
|
|
|
3763
3823
|
|
|
@@ -3807,9 +3867,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3807
3867
|
|
|
3808
3868
|
t.updateLine([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
|
|
3809
3869
|
}
|
|
3810
|
-
/*
|
|
3811
|
-
面数据处理
|
|
3812
|
-
先全删除,再新增
|
|
3870
|
+
/*
|
|
3871
|
+
面数据处理
|
|
3872
|
+
先全删除,再新增
|
|
3813
3873
|
*/
|
|
3814
3874
|
|
|
3815
3875
|
|
|
@@ -3859,9 +3919,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3859
3919
|
|
|
3860
3920
|
t.updatePolygon([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
|
|
3861
3921
|
}
|
|
3862
|
-
/*
|
|
3863
|
-
圆数据处理
|
|
3864
|
-
先全删除,再新增
|
|
3922
|
+
/*
|
|
3923
|
+
圆数据处理
|
|
3924
|
+
先全删除,再新增
|
|
3865
3925
|
*/
|
|
3866
3926
|
|
|
3867
3927
|
|