Compare commits
2 Commits
a220fbb1ef
...
0b9bda229f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b9bda229f | |||
|
|
427b38c8f1 |
@ -34,13 +34,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.top-panel-number {
|
.top-panel-number {
|
||||||
/* line-height: 60px; // 删除或注释掉这一行 */
|
/* line-height: 60px; */
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
border-right: 1px solid #eceff9;
|
border-right: 1px solid #eceff9;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center; /* 可选:让数字水平居中 */
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.top-panel-tips{
|
.top-panel-tips{
|
||||||
line-height:30px;
|
line-height:30px;
|
||||||
@ -153,7 +153,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="layuimini-main">
|
<div class="layuimini-main">
|
||||||
|
|
||||||
<div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 2em;">
|
<div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 1em;">
|
||||||
<div class="layui-col-xs12 layui-col-md6">
|
<div class="layui-col-xs12 layui-col-md6">
|
||||||
<div class="layui-card top-panel stats-panel">
|
<div class="layui-card top-panel stats-panel">
|
||||||
<div class="layui-card-header">设备数量</div>
|
<div class="layui-card-header">设备数量</div>
|
||||||
@ -398,25 +398,20 @@
|
|||||||
map.removeLayer(currentBaseLayer);
|
map.removeLayer(currentBaseLayer);
|
||||||
currentBaseLayer = mapLayers[mapType];
|
currentBaseLayer = mapLayers[mapType];
|
||||||
map.getLayers().insertAt(0, currentBaseLayer);
|
map.getLayers().insertAt(0, currentBaseLayer);
|
||||||
|
|
||||||
// 更新我的位置标记,使用正确的坐标系
|
|
||||||
updateMyLocationForMapType(mapType);
|
updateMyLocationForMapType(mapType);
|
||||||
|
|
||||||
// 更新设备标记
|
|
||||||
addDeviceMarkers();
|
addDeviceMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据地图类型更新我的位置标记
|
// 根据地图类型更新我的位置标记
|
||||||
function updateMyLocationForMapType(mapType) {
|
function updateMyLocationForMapType(mapType) {
|
||||||
if (myLocationFeature) {
|
if (myLocationFeature) {
|
||||||
// 获取原始坐标
|
|
||||||
var originalCoords = myLocationFeature.get('originalCoords');
|
var originalCoords = myLocationFeature.get('originalCoords');
|
||||||
if (originalCoords) {
|
if (originalCoords) {
|
||||||
var lat = originalCoords.lat;
|
var lat = originalCoords.lat;
|
||||||
var lon = originalCoords.lon;
|
var lon = originalCoords.lon;
|
||||||
var coordinates;
|
var coordinates;
|
||||||
|
|
||||||
// 根据地图类型进行坐标转换
|
|
||||||
if (mapType === 'amap' || mapType === 'amap_satellite') {
|
if (mapType === 'amap' || mapType === 'amap_satellite') {
|
||||||
// 高德地图使用GCJ-02坐标系,需要转换
|
// 高德地图使用GCJ-02坐标系,需要转换
|
||||||
var gcjCoord = transform(lat, lon);
|
var gcjCoord = transform(lat, lon);
|
||||||
@ -425,18 +420,15 @@
|
|||||||
// 天地图使用CGCS2000/WGS84坐标系,直接使用
|
// 天地图使用CGCS2000/WGS84坐标系,直接使用
|
||||||
coordinates = ol.proj.fromLonLat([lon, lat]);
|
coordinates = ol.proj.fromLonLat([lon, lat]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新位置标记的几何坐标
|
|
||||||
myLocationFeature.getGeometry().setCoordinates(coordinates);
|
myLocationFeature.getGeometry().setCoordinates(coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDeviceMarkers() {
|
function addDeviceMarkers() {
|
||||||
// 保存我的位置标记
|
|
||||||
var savedMyLocationFeature = myLocationFeature;
|
var savedMyLocationFeature = myLocationFeature;
|
||||||
|
|
||||||
// 清除现有标记
|
|
||||||
vectorSource.clear();
|
vectorSource.clear();
|
||||||
greenFeatures = [];
|
greenFeatures = [];
|
||||||
orangeFeatures = [];
|
orangeFeatures = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user