@vtx/map 1.1.10 → 1.1.11
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/OlMap/Map.css +43 -0
- package/lib/VtxMap/OlMap/Map.js +130 -4
- 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
|
} // 设置中心点
|
|
@@ -1650,6 +1662,43 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1650
1662
|
t.morepoints.map(function (item, index) {
|
|
1651
1663
|
item.value.clear();
|
|
1652
1664
|
});
|
|
1665
|
+
}
|
|
1666
|
+
/*
|
|
1667
|
+
* 添加信息窗口
|
|
1668
|
+
* params
|
|
1669
|
+
* @position: Array[longitude,latitude]
|
|
1670
|
+
* @content: String|HTML
|
|
1671
|
+
* @close: boolean
|
|
1672
|
+
*/
|
|
1673
|
+
|
|
1674
|
+
}, {
|
|
1675
|
+
key: "showInfoWindow",
|
|
1676
|
+
value: function showInfoWindow() {
|
|
1677
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1678
|
+
var t = this;
|
|
1679
|
+
|
|
1680
|
+
if (t.popupWindow) {
|
|
1681
|
+
t.hideInfoWindow();
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
t.popupWindow = new Popup({
|
|
1685
|
+
map: t.state.gis,
|
|
1686
|
+
position: params.position,
|
|
1687
|
+
innerHTML: params.content,
|
|
1688
|
+
close: params.close
|
|
1689
|
+
});
|
|
1690
|
+
t.popupWindow.showPopup();
|
|
1691
|
+
}
|
|
1692
|
+
}, {
|
|
1693
|
+
key: "hideInfoWindow",
|
|
1694
|
+
value: function hideInfoWindow() {
|
|
1695
|
+
var t = this;
|
|
1696
|
+
|
|
1697
|
+
if (t.popupWindow) {
|
|
1698
|
+
t.popupWindow.removePopup();
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
t.popupWindow = null;
|
|
1653
1702
|
} // 添加点
|
|
1654
1703
|
|
|
1655
1704
|
}, {
|
|
@@ -1718,7 +1767,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1718
1767
|
});
|
|
1719
1768
|
t.state.gis.addOverlay(pop);
|
|
1720
1769
|
} else {
|
|
1721
|
-
|
|
1770
|
+
// item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
|
|
1771
|
+
canvasDataURL(item.url || require("../images/defaultMarker.png"), {
|
|
1722
1772
|
width: cg.width,
|
|
1723
1773
|
height: cg.height
|
|
1724
1774
|
}, function (base64) {
|
|
@@ -1730,7 +1780,6 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1730
1780
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
1731
1781
|
anchorXUnits: 'pixels',
|
|
1732
1782
|
anchorYUnits: 'pixels',
|
|
1733
|
-
// src: item.url || `${configUrl.mapServerURL}/images/defaultMarker.png`,
|
|
1734
1783
|
img: myImage,
|
|
1735
1784
|
imgSize: [cg.width, cg.height],
|
|
1736
1785
|
opacity: cg.opacity,
|
|
@@ -1874,7 +1923,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1874
1923
|
overlay.setPosition([item.longitude, item.latitude]);
|
|
1875
1924
|
t.state.gis.changed();
|
|
1876
1925
|
} else {
|
|
1877
|
-
canvasDataURL(item.url ||
|
|
1926
|
+
canvasDataURL(item.url || require("../images/defaultMarker.png"), {
|
|
1878
1927
|
width: cg.width,
|
|
1879
1928
|
height: cg.height
|
|
1880
1929
|
}, function (base64) {
|
|
@@ -3953,6 +4002,83 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3953
4002
|
var _default = OlMap;
|
|
3954
4003
|
exports["default"] = _default;
|
|
3955
4004
|
|
|
4005
|
+
var Popup = /*#__PURE__*/function (_React$Component2) {
|
|
4006
|
+
_inherits(Popup, _React$Component2);
|
|
4007
|
+
|
|
4008
|
+
var _super2 = _createSuper(Popup);
|
|
4009
|
+
|
|
4010
|
+
function Popup(props) {
|
|
4011
|
+
var _this8;
|
|
4012
|
+
|
|
4013
|
+
_classCallCheck(this, Popup);
|
|
4014
|
+
|
|
4015
|
+
_this8 = _super2.call(this);
|
|
4016
|
+
_this8.map = props.map;
|
|
4017
|
+
_this8.position = props.position;
|
|
4018
|
+
_this8.overlay = null;
|
|
4019
|
+
_this8.container = null;
|
|
4020
|
+
_this8.innerHTML = props.innerHTML;
|
|
4021
|
+
_this8.closeble = props.close;
|
|
4022
|
+
return _this8;
|
|
4023
|
+
} // 弹出框
|
|
4024
|
+
|
|
4025
|
+
|
|
4026
|
+
_createClass(Popup, [{
|
|
4027
|
+
key: "showPopup",
|
|
4028
|
+
value: function showPopup() {
|
|
4029
|
+
var t = this;
|
|
4030
|
+
this.removePopup(); // 获取弹出层DOM
|
|
4031
|
+
|
|
4032
|
+
t.container = document.createElement("div");
|
|
4033
|
+
t.container['className'] = "ol-popup";
|
|
4034
|
+
|
|
4035
|
+
if (t.closeble) {
|
|
4036
|
+
var close = document.createElement("a");
|
|
4037
|
+
close['className'] = "ol-popup-closer";
|
|
4038
|
+
close.addEventListener("click", function (e) {
|
|
4039
|
+
t.removePopup();
|
|
4040
|
+
});
|
|
4041
|
+
t.container.appendChild(close);
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
var content = document.createElement("div");
|
|
4045
|
+
t.container.appendChild(content);
|
|
4046
|
+
|
|
4047
|
+
if (t.overlay) {} else {
|
|
4048
|
+
// 创建Overlay弹出层绑定DOM
|
|
4049
|
+
t.overlay = new ol.Overlay({
|
|
4050
|
+
element: t.container,
|
|
4051
|
+
autoPan: {
|
|
4052
|
+
animation: {
|
|
4053
|
+
duration: 250
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
}); // 添加到map
|
|
4057
|
+
|
|
4058
|
+
t.map.addOverlay(t.overlay);
|
|
4059
|
+
} // 弹出层内容
|
|
4060
|
+
|
|
4061
|
+
|
|
4062
|
+
content.innerHTML = t.innerHTML; // 设置弹出层位置即可出现
|
|
4063
|
+
|
|
4064
|
+
t.overlay.setPosition(t.position);
|
|
4065
|
+
} // 清除弹出框
|
|
4066
|
+
|
|
4067
|
+
}, {
|
|
4068
|
+
key: "removePopup",
|
|
4069
|
+
value: function removePopup() {
|
|
4070
|
+
if (this.overlay) {
|
|
4071
|
+
this.container.remove(); // 设置位置undefined可达到隐藏清除弹出框
|
|
4072
|
+
|
|
4073
|
+
this.overlay.setPosition(undefined);
|
|
4074
|
+
this.overlay = null;
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
}]);
|
|
4078
|
+
|
|
4079
|
+
return Popup;
|
|
4080
|
+
}(_react["default"].Component);
|
|
4081
|
+
|
|
3956
4082
|
function getRgbColor(color, opacity) {
|
|
3957
4083
|
var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
|
|
3958
4084
|
|