支持从第三方读取地图配置
This commit is contained in:
@@ -75,6 +75,16 @@ public class VideoManagerConstants {
|
||||
*/
|
||||
public static final String VM_MSG_PUSH_STREAM_LIST_CHANGE = "VM_MSG_PUSH_STREAM_LIST_CHANGE";
|
||||
|
||||
/**
|
||||
* 请求同步三方组织结构
|
||||
*/
|
||||
public static final String VM_MSG_GROUP_LIST_REQUEST = "VM_MSG_GROUP_LIST_REQUEST";
|
||||
|
||||
/**
|
||||
* 同步三方组织结构回复
|
||||
*/
|
||||
public static final String VM_MSG_GROUP_LIST_RESPONSE = "VM_MSG_GROUP_LIST_RESPONSE";
|
||||
|
||||
/**
|
||||
* redis 消息通知设备推流到平台
|
||||
*/
|
||||
|
||||
@@ -42,4 +42,5 @@ public class RedisTemplateConfig {
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
// TODO 处理各个状态
|
||||
switch (jwtUser.getStatus()){
|
||||
case EXPIRED:
|
||||
response.setStatus(400);
|
||||
response.setStatus(401);
|
||||
chain.doFilter(request, response);
|
||||
// 异常
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,6 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
@Schema(description = "经度 WGS-84坐标系")
|
||||
private Double longitude;
|
||||
|
||||
|
||||
@MessageElementForCatalog("Latitude")
|
||||
@Schema(description = ",纬度 WGS-84坐标系")
|
||||
private Double latitude;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RedisGroupMessage {
|
||||
|
||||
/**
|
||||
* 分组国标ID
|
||||
*/
|
||||
private String groupGbId;
|
||||
|
||||
/**
|
||||
* 分组别名
|
||||
*/
|
||||
private String groupAlias;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 分组所属的行政区划
|
||||
*/
|
||||
private String groupCivilCode;
|
||||
|
||||
/**
|
||||
* 分组所属父分组国标ID
|
||||
*/
|
||||
private String parentGroupGbId;
|
||||
|
||||
/**
|
||||
* 分组所属父分组别名
|
||||
*/
|
||||
private String parentGAlias;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
RedisGroupMessage redisGroupMessage = new RedisGroupMessage();
|
||||
redisGroupMessage.setGroupAlias("100000001");
|
||||
redisGroupMessage.setGroupName("消防大队");
|
||||
System.out.println(JSON.toJSONString(redisGroupMessage));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
@@ -434,6 +435,17 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
|
||||
@Override
|
||||
public void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition) {
|
||||
|
||||
if (device.getGeoCoordSys().equalsIgnoreCase("GCJ02")) {
|
||||
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||
mobilePosition.setLongitude(wgs84Position[0]);
|
||||
mobilePosition.setLatitude(wgs84Position[1]);
|
||||
|
||||
Double[] wgs84PositionForChannel = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||
deviceChannel.setGbLongitude(wgs84PositionForChannel[0]);
|
||||
deviceChannel.setGbLatitude(wgs84PositionForChannel[1]);
|
||||
}
|
||||
|
||||
if (userSetting.getSavePositionHistory()) {
|
||||
deviceMobilePositionMapper.insertNewPosition(mobilePosition);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.genersoft.iot.vmp.service;
|
||||
|
||||
import com.genersoft.iot.vmp.vmanager.bean.MapConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMapService {
|
||||
List<MapConfig> getConfig();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.service.IMapService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.MapConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方地图适配
|
||||
*/
|
||||
@Service
|
||||
public class MapServiceImplForSy implements IMapService {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MapConfig> getConfig() {
|
||||
List<MapConfig> configList = new ArrayList<>();
|
||||
JSONObject configObject = (JSONObject)redisTemplate.opsForValue().get("interfaceConfig1");
|
||||
if (configObject == null) {
|
||||
return configList;
|
||||
}
|
||||
// 浅色地图
|
||||
MapConfig mapConfigForDefault = readConfig("FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForDefault != null) {
|
||||
mapConfigForDefault.setName("浅色地图");
|
||||
configList.add(mapConfigForDefault);
|
||||
}
|
||||
|
||||
// 深色地图
|
||||
MapConfig mapConfigForDark = readConfig("POLARNIGHTBLUE_FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForDark != null) {
|
||||
mapConfigForDark.setName("深色地图");
|
||||
configList.add(mapConfigForDark);
|
||||
}
|
||||
|
||||
// 卫星地图
|
||||
MapConfig mapConfigForSatellited = readConfig("FRAGMENTIMG_SERVER", configObject);
|
||||
if (mapConfigForSatellited != null) {
|
||||
mapConfigForSatellited.setName("卫星地图");
|
||||
configList.add(mapConfigForSatellited);
|
||||
}
|
||||
return configList;
|
||||
}
|
||||
|
||||
private MapConfig readConfig(String key, JSONObject jsonObject) {
|
||||
JSONArray fragmentimgServerArray = jsonObject.getJSONArray(key);
|
||||
if (fragmentimgServerArray == null || fragmentimgServerArray.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONObject fragmentimgServer = fragmentimgServerArray.getJSONObject(0);
|
||||
// 坐标系
|
||||
String geoCoordSys = fragmentimgServer.getString("csysType").toUpperCase();
|
||||
// 获取地址
|
||||
String path = fragmentimgServer.getString("path");
|
||||
String ip = fragmentimgServer.getString("ip");
|
||||
JSONObject portJson = fragmentimgServer.getJSONObject("port");
|
||||
JSONObject httpPortJson = portJson.getJSONObject("httpPort");
|
||||
String protocol = httpPortJson.getString("portType");
|
||||
Integer port = httpPortJson.getInteger("port");
|
||||
String tileUrl = String.format("%s://%s:%s%s", protocol, ip, port, path);
|
||||
MapConfig mapConfig = new MapConfig();
|
||||
mapConfig.setCoordinateSystem(geoCoordSys);
|
||||
mapConfig.setTilesUrl(tileUrl);
|
||||
return mapConfig;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,10 @@ public class RedisPushStreamMessage {
|
||||
private String stream;
|
||||
private String name;
|
||||
private boolean status;
|
||||
// 终端所属的虚拟组织
|
||||
private String groupGbId;
|
||||
// 终端所属的虚拟组织别名 可选,可作为地方同步组织结构到wvp时的关联关系
|
||||
private String groupAlias;
|
||||
|
||||
public StreamPush buildstreamPush() {
|
||||
StreamPush push = new StreamPush();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MapConfig {
|
||||
|
||||
private String name;
|
||||
private String coordinateSystem;
|
||||
private String tilesUrl;
|
||||
private Integer tileSize;
|
||||
private Integer zoom;
|
||||
private Double[] center;
|
||||
private Integer maxZoom;
|
||||
private Integer minZoom;
|
||||
}
|
||||
@@ -16,18 +16,17 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerChangeEvent;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IMapService;
|
||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.SystemConfigInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -42,7 +41,6 @@ import oshi.hardware.HardwareAbstractionLayer;
|
||||
import oshi.hardware.NetworkIF;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -85,6 +83,10 @@ public class ServerController {
|
||||
@Autowired
|
||||
private IStreamProxyService proxyService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IMapService mapService;
|
||||
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
|
||||
@@ -362,4 +364,11 @@ public class ServerController {
|
||||
double tbNumber = gbNumber / FORMAT;
|
||||
return new DecimalFormat("#.##TB").format(tbNumber);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/map/config")
|
||||
@ResponseBody
|
||||
@Operation(summary = "获取地图配置", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
public List<MapConfig> getMapConfig() {
|
||||
return mapService.getConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ window.baseUrl = ""
|
||||
window.mapParam = {
|
||||
// 开启/关闭地图功能
|
||||
enable: true,
|
||||
// 坐标系 GCJ-02 WGS-84,
|
||||
coordinateSystem: "GCJ-02",
|
||||
// 坐标系 GCJ02 WGS84,
|
||||
coordinateSystem: "GCJ02",
|
||||
// 地图瓦片地址
|
||||
tilesUrl: "http://webrd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8",
|
||||
// 瓦片大小
|
||||
|
||||
@@ -115,3 +115,10 @@ export function info() {
|
||||
})
|
||||
}
|
||||
|
||||
export function getMapConfig() {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: `/api/server/map/config`
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
checkMediaServer,
|
||||
checkMediaServerRecord, deleteMediaServer, getMediaInfo,
|
||||
checkMediaServerRecord, deleteMediaServer, getMapConfig, getMediaInfo,
|
||||
getMediaServer,
|
||||
getMediaServerList, getMediaServerLoad,
|
||||
getOnlineMediaServerList, getResourceInfo, getSystemConfig, getSystemInfo, info, saveMediaServer
|
||||
@@ -136,6 +136,16 @@ const actions = {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
getMapConfig({ commit }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getMapConfig().then(response => {
|
||||
const { data } = response
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 1291092 */
|
||||
src: url('iconfont.woff2?t=1758456390170') format('woff2')
|
||||
src: url('iconfont.woff2?t=1758784486763') format('woff2')
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@@ -11,6 +11,158 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-mti-duobianxingxuan:before {
|
||||
content: "\e9e7";
|
||||
}
|
||||
|
||||
.icon-mti-fengwotu:before {
|
||||
content: "\e9e8";
|
||||
}
|
||||
|
||||
.icon-mti-fangda:before {
|
||||
content: "\e9e9";
|
||||
}
|
||||
|
||||
.icon-mti-huizhi:before {
|
||||
content: "\e9ea";
|
||||
}
|
||||
|
||||
.icon-mti-guijihuifang:before {
|
||||
content: "\e9eb";
|
||||
}
|
||||
|
||||
.icon-mti-huodongguiji:before {
|
||||
content: "\e9ed";
|
||||
}
|
||||
|
||||
.icon-mti-juliceliang:before {
|
||||
content: "\e9ee";
|
||||
}
|
||||
|
||||
.icon-mti-jutai:before {
|
||||
content: "\e9ef";
|
||||
}
|
||||
|
||||
.icon-mti-kuangxuan:before {
|
||||
content: "\e9f0";
|
||||
}
|
||||
|
||||
.icon-mti-lukuang:before {
|
||||
content: "\e9f1";
|
||||
}
|
||||
|
||||
.icon-a-mti-qiehuanshijiaomti-sanwei:before {
|
||||
content: "\e9f2";
|
||||
}
|
||||
|
||||
.icon-mti-mianjiceliang:before {
|
||||
content: "\e9f3";
|
||||
}
|
||||
|
||||
.icon-mti-lukuang2:before {
|
||||
content: "\e9f4";
|
||||
}
|
||||
|
||||
.icon-mti-sandian:before {
|
||||
content: "\e9f7";
|
||||
}
|
||||
|
||||
.icon-mti-relitu:before {
|
||||
content: "\e9f8";
|
||||
}
|
||||
|
||||
.icon-mti-sanwei:before {
|
||||
content: "\e9f9";
|
||||
}
|
||||
|
||||
.icon-mti-quanxuan:before {
|
||||
content: "\e9fa";
|
||||
}
|
||||
|
||||
.icon-mti-suoxiao:before {
|
||||
content: "\e9fb";
|
||||
}
|
||||
|
||||
.icon-mti-tucengfenlei:before {
|
||||
content: "\e9fc";
|
||||
}
|
||||
|
||||
.icon-mti-tianjiadingweiquyu:before {
|
||||
content: "\e9fd";
|
||||
}
|
||||
|
||||
.icon-mti-tianjiadingwei:before {
|
||||
content: "\e9fe";
|
||||
}
|
||||
|
||||
.icon-mti-tujingdian:before {
|
||||
content: "\e9ff";
|
||||
}
|
||||
|
||||
.icon-mti-xinzengdian:before {
|
||||
content: "\ea00";
|
||||
}
|
||||
|
||||
.icon-mti-xianxuan:before {
|
||||
content: "\ea01";
|
||||
}
|
||||
|
||||
.icon-mti-xuanze:before {
|
||||
content: "\ea02";
|
||||
}
|
||||
|
||||
.icon-mti-xinzengxian:before {
|
||||
content: "\ea03";
|
||||
}
|
||||
|
||||
.icon-mti-yangshi:before {
|
||||
content: "\ea04";
|
||||
}
|
||||
|
||||
.icon-mti-yingyantu:before {
|
||||
content: "\ea05";
|
||||
}
|
||||
|
||||
.icon-mti-yunhangguiji:before {
|
||||
content: "\ea06";
|
||||
}
|
||||
|
||||
.icon-mti-ziyuanbukong:before {
|
||||
content: "\ea08";
|
||||
}
|
||||
|
||||
.icon-mti-zhongdianquyu:before {
|
||||
content: "\ea09";
|
||||
}
|
||||
|
||||
.icon-mti-zongheceliang:before {
|
||||
content: "\ea0a";
|
||||
}
|
||||
|
||||
.icon-mti-POIxinxi:before {
|
||||
content: "\e9e2";
|
||||
}
|
||||
|
||||
.icon-mti-celiang:before {
|
||||
content: "\e9e3";
|
||||
}
|
||||
|
||||
.icon-mti-dituqiehuan:before {
|
||||
content: "\e9e4";
|
||||
}
|
||||
|
||||
.icon-mti-diliweilan:before {
|
||||
content: "\e9e5";
|
||||
}
|
||||
|
||||
.icon-mti-erwei:before {
|
||||
content: "\e9e6";
|
||||
}
|
||||
|
||||
.icon-tuceng:before {
|
||||
content: "\e7f2";
|
||||
}
|
||||
|
||||
.icon-a-bofangqi1:before {
|
||||
content: "\ec17";
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -36,15 +36,16 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
overlayId: null,
|
||||
dragInteraction: new DragInteraction()
|
||||
dragInteraction: new DragInteraction(),
|
||||
mapTileList: [],
|
||||
mapTileIndex: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
}, 100)
|
||||
this.init()
|
||||
})
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@@ -53,6 +54,23 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.$store.dispatch('server/getMapConfig')
|
||||
.then(mapConfigList => {
|
||||
console.log(mapConfigList.length)
|
||||
if (mapConfigList.length === 0) {
|
||||
if (window.mapParam.tilesUrl) {
|
||||
this.mapTileList.push({
|
||||
tilesUrl: window.mapParam.tilesUrl,
|
||||
coordinateSystem: window.mapParam.coordinateSystem
|
||||
})
|
||||
}
|
||||
}else {
|
||||
this.mapTileList = mapConfigList
|
||||
}
|
||||
this.initMap()
|
||||
})
|
||||
},
|
||||
initMap(){
|
||||
let center = fromLonLat([116.41020, 39.915119])
|
||||
if (window.mapParam.center) {
|
||||
center = fromLonLat(window.mapParam.center)
|
||||
@@ -65,13 +83,13 @@ export default {
|
||||
minZoom: window.mapParam.minZoom || 1
|
||||
})
|
||||
let tileLayer = null
|
||||
if (window.mapParam.tilesUrl) {
|
||||
if (this.mapTileList.length > 0 && this.mapTileList[this.mapTileIndex].tilesUrl) {
|
||||
tileLayer = new Tile({
|
||||
source: new XYZ({
|
||||
projection: getProj('EPSG:3857'),
|
||||
wrapX: false,
|
||||
tileSize: 256 || window.mapParam.tileSize,
|
||||
url: window.mapParam.tilesUrl
|
||||
url: this.mapTileList[this.mapTileIndex].tilesUrl
|
||||
})
|
||||
})
|
||||
} else {
|
||||
@@ -179,7 +197,6 @@ export default {
|
||||
},
|
||||
openInfoBox(position, content, offset) {
|
||||
if (this.overlayId !== null) {
|
||||
console.log(this.overlayId)
|
||||
this.closeInfoBox(this.overlayId)
|
||||
this.overlayId = null
|
||||
}
|
||||
@@ -354,6 +371,9 @@ export default {
|
||||
olMap.addLayer(vectorLayer)
|
||||
return vectorLayer
|
||||
}
|
||||
},
|
||||
getCurrentCoordinateSystem() {
|
||||
return this.mapTileList[this.mapTileIndex].coordinateSystem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
<el-option key="UTF-8" label="UTF-8" value="utf-8" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="坐标系" prop="geoCoordSys">
|
||||
<el-select v-model="form.geoCoordSys" style="float: left; width: 100%">
|
||||
<el-option key="WGS84" label="WGS84" value="gb2312" />
|
||||
<el-option key="GCJ02" label="GCJ02" value="utf-8" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他选项">
|
||||
<el-checkbox v-model="form.ssrcCheck" label="SSRC校验" style="float: left" />
|
||||
<el-checkbox v-model="form.asMessageChannel" label="作为消息通道" style="float: left" />
|
||||
@@ -169,7 +169,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import deviceEdit from '../dialog/deviceEdit.vue'
|
||||
import deviceEdit from './edit.vue'
|
||||
import syncChannelProgress from '../dialog/SyncChannelProgress.vue'
|
||||
import configInfo from '../dialog/configInfo.vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
<MapComponent ref="mapComponent" @loaded="initChannelLayer"></MapComponent>
|
||||
</div>
|
||||
<div class="map-tool-box">
|
||||
<div class="map-tool-btn-group">
|
||||
<div class="map-tool-btn" @click="initChannelLayer">
|
||||
<i class="iconfont icon-tuceng"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="map-tool-btn-group">
|
||||
<div class="map-tool-btn" @click="initChannelLayer">
|
||||
<i class="iconfont icon-shuaxin3"></i>
|
||||
@@ -60,6 +65,7 @@ import DeviceTree from '../common/DeviceTree.vue'
|
||||
import queryTrace from './queryTrace.vue'
|
||||
import MapComponent from '../common/MapComponent.vue'
|
||||
import devicePlayer from '../common/channelPlayer/index.vue'
|
||||
import gcoord from 'gcoord'
|
||||
|
||||
export default {
|
||||
name: 'Map',
|
||||
@@ -151,16 +157,18 @@ export default {
|
||||
initChannelLayer: function () {
|
||||
// 获取所有有位置的通道
|
||||
this.closeInfoBox()
|
||||
this.$store.dispatch('commonChanel/getAllForMap', {
|
||||
geoCoordSys: window.mapParam.coordinateSystem
|
||||
}).then(data => {
|
||||
this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => {
|
||||
let array = []
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let item = data[i]
|
||||
if (item.gbLongitude && item.gbLatitude) {
|
||||
let position = [item.gbLongitude, item.gbLatitude]
|
||||
let gcj02Position = gcoord.transform(position, gcoord.WGS84, gcoord.GCJ02)
|
||||
item.gbLongitude = gcj02Position[0]
|
||||
item.gbLatitude = gcj02Position[1]
|
||||
array.push({
|
||||
id: item.gbId,
|
||||
position: [item.gbLongitude, item.gbLatitude],
|
||||
position: gcj02Position,
|
||||
data: item,
|
||||
image: {
|
||||
anchor: [0.5, 1],
|
||||
@@ -291,6 +299,12 @@ export default {
|
||||
})
|
||||
},
|
||||
submitEdit: function(channel) {
|
||||
let position = [channel.gbLongitude, channel.gbLatitude]
|
||||
if (this.$refs.mapComponent.getCurrentCoordinateSystem() === 'GCJ02') {
|
||||
let wgs84Position = gcoord.transform(position, gcoord.GCJ02, gcoord.WGS84)
|
||||
channel.gbLongitude = wgs84Position[0]
|
||||
channel.gbLatitude = wgs84Position[1]
|
||||
}
|
||||
this.$store.dispatch('commonChanel/update', channel)
|
||||
.then(data => {
|
||||
this.$message.success({
|
||||
@@ -302,7 +316,7 @@ export default {
|
||||
this.$refs.mapComponent.dragInteraction.removeFeatureId(channel.gbId)
|
||||
this.$refs.mapComponent.setFeaturePositionById(this.channelLayer, channel.gbId, {
|
||||
id: channel.gbId,
|
||||
position: [channel.gbLongitude, channel.gbLatitude],
|
||||
position: position,
|
||||
data: channel,
|
||||
image: {
|
||||
anchor: [0.5, 1],
|
||||
|
||||
Reference in New Issue
Block a user