@vtx/map 1.1.10 → 1.1.13
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/AMap/AMap.js +17 -18
- package/lib/VtxMap/AMap/AMap.js.map +1 -1
- package/lib/VtxMap/OlMap/Map.css +43 -0
- package/lib/VtxMap/OlMap/Map.js +179 -18
- package/lib/VtxMap/OlMap/Map.js.map +1 -1
- package/lib/VtxMap/OlMap/Map.less +43 -0
- package/lib/VtxMap/images/defaultMarker.png +0 -0
- package/lib/VtxMap/images/defaultMarker_selected.png +0 -0
- package/lib/VtxSearchMap/VtxSearchMap.js +4 -2
- package/lib/VtxSearchMap/VtxSearchMap.js.map +1 -1
- package/package.json +1 -1
package/lib/VtxMap/OlMap/Map.css
CHANGED
|
@@ -124,3 +124,46 @@
|
|
|
124
124
|
.ol-tooltip-static:before {
|
|
125
125
|
border-top-color: #ffcc33;
|
|
126
126
|
}
|
|
127
|
+
.ol-popup {
|
|
128
|
+
position: absolute;
|
|
129
|
+
background-color: white;
|
|
130
|
+
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
|
131
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
|
132
|
+
padding: 15px;
|
|
133
|
+
border-radius: 10px;
|
|
134
|
+
border: 1px solid #cccccc;
|
|
135
|
+
bottom: 12px;
|
|
136
|
+
left: -50px;
|
|
137
|
+
min-width: 280px;
|
|
138
|
+
}
|
|
139
|
+
.ol-popup:after,
|
|
140
|
+
.ol-popup:before {
|
|
141
|
+
top: 100%;
|
|
142
|
+
border: solid transparent;
|
|
143
|
+
content: " ";
|
|
144
|
+
height: 0;
|
|
145
|
+
width: 0;
|
|
146
|
+
position: absolute;
|
|
147
|
+
pointer-events: none;
|
|
148
|
+
}
|
|
149
|
+
.ol-popup:after {
|
|
150
|
+
border-top-color: white;
|
|
151
|
+
border-width: 10px;
|
|
152
|
+
left: 48px;
|
|
153
|
+
margin-left: -10px;
|
|
154
|
+
}
|
|
155
|
+
.ol-popup:before {
|
|
156
|
+
border-top-color: #cccccc;
|
|
157
|
+
border-width: 11px;
|
|
158
|
+
left: 48px;
|
|
159
|
+
margin-left: -11px;
|
|
160
|
+
}
|
|
161
|
+
.ol-popup-closer {
|
|
162
|
+
text-decoration: none;
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: 2px;
|
|
165
|
+
right: 8px;
|
|
166
|
+
}
|
|
167
|
+
.ol-popup-closer:after {
|
|
168
|
+
content: "✖";
|
|
169
|
+
}
|
package/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -513,7 +513,19 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
513
513
|
t.setCenter(gt);
|
|
514
514
|
};
|
|
515
515
|
|
|
516
|
-
t.state.gis["
|
|
516
|
+
t.state.gis["getZoomLevel"] = function () {
|
|
517
|
+
return t.getZoomLevel();
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
t.state.gis["showInfoWindow"] = function (obj) {
|
|
521
|
+
return t.showInfoWindow(obj);
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
t.state.gis["hideInfoWindow"] = function () {
|
|
525
|
+
return t.hideInfoWindow();
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
t.state.gis["refresh"] = function () {
|
|
517
529
|
t.refresh();
|
|
518
530
|
};
|
|
519
531
|
} // 设置中心点
|
|
@@ -856,6 +868,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
856
868
|
scale: drawParam.parameter.scale || 1
|
|
857
869
|
})
|
|
858
870
|
});
|
|
871
|
+
var geometryFunction;
|
|
859
872
|
|
|
860
873
|
switch (drawParam.geometryType) {
|
|
861
874
|
case 'point':
|
|
@@ -897,6 +910,11 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
897
910
|
});
|
|
898
911
|
break;
|
|
899
912
|
|
|
913
|
+
case 'rectangle':
|
|
914
|
+
type = 'Circle';
|
|
915
|
+
geometryFunction = ol.interaction.Draw.createBox();
|
|
916
|
+
break;
|
|
917
|
+
|
|
900
918
|
case 'circle':
|
|
901
919
|
type = 'Circle';
|
|
902
920
|
style = new ol.style.Style({
|
|
@@ -915,7 +933,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
915
933
|
if (!t.drawToolbar) {
|
|
916
934
|
t.drawToolbar = new ol.interaction.Draw({
|
|
917
935
|
source: t.drawSource,
|
|
918
|
-
type: type
|
|
936
|
+
type: type,
|
|
937
|
+
geometryFunction: geometryFunction // style: style
|
|
919
938
|
|
|
920
939
|
});
|
|
921
940
|
gis.addInteraction(t.drawToolbar);
|
|
@@ -1044,14 +1063,42 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1044
1063
|
};
|
|
1045
1064
|
}
|
|
1046
1065
|
|
|
1047
|
-
if (t.drawParam.geometryType == '
|
|
1048
|
-
var
|
|
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;
|
|
1049
1077
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
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
|
+
}
|
|
1054
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);
|
|
1055
1102
|
t.addCircle([{
|
|
1056
1103
|
id: t.drawParam.data.id,
|
|
1057
1104
|
longitude: center[0],
|
|
@@ -1650,6 +1697,43 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1650
1697
|
t.morepoints.map(function (item, index) {
|
|
1651
1698
|
item.value.clear();
|
|
1652
1699
|
});
|
|
1700
|
+
}
|
|
1701
|
+
/*
|
|
1702
|
+
* 添加信息窗口
|
|
1703
|
+
* params
|
|
1704
|
+
* @position: Array[longitude,latitude]
|
|
1705
|
+
* @content: String|HTML
|
|
1706
|
+
* @close: boolean
|
|
1707
|
+
*/
|
|
1708
|
+
|
|
1709
|
+
}, {
|
|
1710
|
+
key: "showInfoWindow",
|
|
1711
|
+
value: function showInfoWindow() {
|
|
1712
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1713
|
+
var t = this;
|
|
1714
|
+
|
|
1715
|
+
if (t.popupWindow) {
|
|
1716
|
+
t.hideInfoWindow();
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
t.popupWindow = new Popup({
|
|
1720
|
+
map: t.state.gis,
|
|
1721
|
+
position: params.position,
|
|
1722
|
+
innerHTML: params.content,
|
|
1723
|
+
close: params.close
|
|
1724
|
+
});
|
|
1725
|
+
t.popupWindow.showPopup();
|
|
1726
|
+
}
|
|
1727
|
+
}, {
|
|
1728
|
+
key: "hideInfoWindow",
|
|
1729
|
+
value: function hideInfoWindow() {
|
|
1730
|
+
var t = this;
|
|
1731
|
+
|
|
1732
|
+
if (t.popupWindow) {
|
|
1733
|
+
t.popupWindow.removePopup();
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
t.popupWindow = null;
|
|
1653
1737
|
} // 添加点
|
|
1654
1738
|
|
|
1655
1739
|
}, {
|
|
@@ -1718,7 +1802,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1718
1802
|
});
|
|
1719
1803
|
t.state.gis.addOverlay(pop);
|
|
1720
1804
|
} else {
|
|
1721
|
-
|
|
1805
|
+
// item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
|
|
1806
|
+
canvasDataURL(item.url || require("../images/defaultMarker.png"), {
|
|
1722
1807
|
width: cg.width,
|
|
1723
1808
|
height: cg.height
|
|
1724
1809
|
}, function (base64) {
|
|
@@ -1730,7 +1815,6 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1730
1815
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
1731
1816
|
anchorXUnits: 'pixels',
|
|
1732
1817
|
anchorYUnits: 'pixels',
|
|
1733
|
-
// src: item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
|
|
1734
1818
|
img: myImage,
|
|
1735
1819
|
imgSize: [cg.width, cg.height],
|
|
1736
1820
|
opacity: cg.opacity,
|
|
@@ -1874,7 +1958,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1874
1958
|
overlay.setPosition([item.longitude, item.latitude]);
|
|
1875
1959
|
t.state.gis.changed();
|
|
1876
1960
|
} else {
|
|
1877
|
-
canvasDataURL(item.url ||
|
|
1961
|
+
canvasDataURL(item.url || require("../images/defaultMarker.png"), {
|
|
1878
1962
|
width: cg.width,
|
|
1879
1963
|
height: cg.height
|
|
1880
1964
|
}, function (base64) {
|
|
@@ -2670,8 +2754,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2670
2754
|
value: function setAreaRestriction(areaRestriction) {
|
|
2671
2755
|
var t = this;
|
|
2672
2756
|
|
|
2673
|
-
var _t$
|
|
2674
|
-
_et = _t$
|
|
2757
|
+
var _t$dealData6 = t.dealData(areaRestriction),
|
|
2758
|
+
_et = _t$dealData6._extent;
|
|
2675
2759
|
|
|
2676
2760
|
t.areaRestriction = t.state.gis.getView().setProperties({
|
|
2677
2761
|
extent: [_et.xmax, _et.ymax, _et.xmin, _et.ymin]
|
|
@@ -2768,7 +2852,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2768
2852
|
|
|
2769
2853
|
function clusterMemberStyle(clusterMember) {
|
|
2770
2854
|
var style = clusterMember.getStyle();
|
|
2771
|
-
var image = style.getImage();
|
|
2855
|
+
var image = style && style.getImage ? style.getImage() : null;
|
|
2772
2856
|
return new ol.style.Style({
|
|
2773
2857
|
geometry: clusterMember.getGeometry(),
|
|
2774
2858
|
image: image
|
|
@@ -3698,12 +3782,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3698
3782
|
var obj = t.getMapExtent();
|
|
3699
3783
|
obj.e = e;
|
|
3700
3784
|
obj.clickLngLat = {
|
|
3701
|
-
lng:
|
|
3702
|
-
lat:
|
|
3785
|
+
lng: e.coordinate ? e.coordinate[0] : undefined,
|
|
3786
|
+
lat: e.coordinate ? e.coordinate[1] : undefined
|
|
3703
3787
|
};
|
|
3704
3788
|
obj.pixel = {
|
|
3705
|
-
x:
|
|
3706
|
-
y:
|
|
3789
|
+
x: e.pixel ? e.pixel[0] : undefined,
|
|
3790
|
+
y: e.pixel ? e.pixel[1] : undefined
|
|
3707
3791
|
};
|
|
3708
3792
|
t.props.clickMap(obj);
|
|
3709
3793
|
}
|
|
@@ -3953,6 +4037,83 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3953
4037
|
var _default = OlMap;
|
|
3954
4038
|
exports["default"] = _default;
|
|
3955
4039
|
|
|
4040
|
+
var Popup = /*#__PURE__*/function (_React$Component2) {
|
|
4041
|
+
_inherits(Popup, _React$Component2);
|
|
4042
|
+
|
|
4043
|
+
var _super2 = _createSuper(Popup);
|
|
4044
|
+
|
|
4045
|
+
function Popup(props) {
|
|
4046
|
+
var _this8;
|
|
4047
|
+
|
|
4048
|
+
_classCallCheck(this, Popup);
|
|
4049
|
+
|
|
4050
|
+
_this8 = _super2.call(this);
|
|
4051
|
+
_this8.map = props.map;
|
|
4052
|
+
_this8.position = props.position;
|
|
4053
|
+
_this8.overlay = null;
|
|
4054
|
+
_this8.container = null;
|
|
4055
|
+
_this8.innerHTML = props.innerHTML;
|
|
4056
|
+
_this8.closeble = props.close;
|
|
4057
|
+
return _this8;
|
|
4058
|
+
} // 弹出框
|
|
4059
|
+
|
|
4060
|
+
|
|
4061
|
+
_createClass(Popup, [{
|
|
4062
|
+
key: "showPopup",
|
|
4063
|
+
value: function showPopup() {
|
|
4064
|
+
var t = this;
|
|
4065
|
+
this.removePopup(); // 获取弹出层DOM
|
|
4066
|
+
|
|
4067
|
+
t.container = document.createElement("div");
|
|
4068
|
+
t.container['className'] = "ol-popup";
|
|
4069
|
+
|
|
4070
|
+
if (t.closeble) {
|
|
4071
|
+
var close = document.createElement("a");
|
|
4072
|
+
close['className'] = "ol-popup-closer";
|
|
4073
|
+
close.addEventListener("click", function (e) {
|
|
4074
|
+
t.removePopup();
|
|
4075
|
+
});
|
|
4076
|
+
t.container.appendChild(close);
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4079
|
+
var content = document.createElement("div");
|
|
4080
|
+
t.container.appendChild(content);
|
|
4081
|
+
|
|
4082
|
+
if (t.overlay) {} else {
|
|
4083
|
+
// 创建Overlay弹出层绑定DOM
|
|
4084
|
+
t.overlay = new ol.Overlay({
|
|
4085
|
+
element: t.container,
|
|
4086
|
+
autoPan: {
|
|
4087
|
+
animation: {
|
|
4088
|
+
duration: 250
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
}); // 添加到map
|
|
4092
|
+
|
|
4093
|
+
t.map.addOverlay(t.overlay);
|
|
4094
|
+
} // 弹出层内容
|
|
4095
|
+
|
|
4096
|
+
|
|
4097
|
+
content.innerHTML = t.innerHTML; // 设置弹出层位置即可出现
|
|
4098
|
+
|
|
4099
|
+
t.overlay.setPosition(t.position);
|
|
4100
|
+
} // 清除弹出框
|
|
4101
|
+
|
|
4102
|
+
}, {
|
|
4103
|
+
key: "removePopup",
|
|
4104
|
+
value: function removePopup() {
|
|
4105
|
+
if (this.overlay) {
|
|
4106
|
+
this.container.remove(); // 设置位置undefined可达到隐藏清除弹出框
|
|
4107
|
+
|
|
4108
|
+
this.overlay.setPosition(undefined);
|
|
4109
|
+
this.overlay = null;
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
}]);
|
|
4113
|
+
|
|
4114
|
+
return Popup;
|
|
4115
|
+
}(_react["default"].Component);
|
|
4116
|
+
|
|
3956
4117
|
function getRgbColor(color, opacity) {
|
|
3957
4118
|
var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
|
|
3958
4119
|
|