修复更新通道是更新各个坐标系德位置信息
This commit is contained in:
@@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
@@ -107,6 +108,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
continue;
|
||||
}
|
||||
DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice, device, null);
|
||||
deviceChannel = SipUtils.updateGps(deviceChannel, device.getGeoCoordSys());
|
||||
deviceChannel.setDeviceId(take.getDevice().getDeviceId());
|
||||
|
||||
channelList.add(deviceChannel);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.utils;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.RemoteAddressInfo;
|
||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||
import gov.nist.javax.sip.address.AddressImpl;
|
||||
@@ -148,4 +149,37 @@ public class SipUtils {
|
||||
|
||||
return new RemoteAddressInfo(remoteAddress, remotePort);
|
||||
}
|
||||
|
||||
public static DeviceChannel updateGps(DeviceChannel deviceChannel, String geoCoordSys) {
|
||||
if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
|
||||
|
||||
if (geoCoordSys == null) {
|
||||
geoCoordSys = "WGS84";
|
||||
}
|
||||
if ("WGS84".equals(geoCoordSys)) {
|
||||
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||
Double[] position = Coordtransform.WGS84ToGCJ02(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||
deviceChannel.setLongitudeGcj02(position[0]);
|
||||
deviceChannel.setLatitudeGcj02(position[1]);
|
||||
}else if ("GCJ02".equals(geoCoordSys)) {
|
||||
deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
||||
deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
||||
Double[] position = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||
deviceChannel.setLongitudeWgs84(position[0]);
|
||||
deviceChannel.setLatitudeWgs84(position[1]);
|
||||
}else {
|
||||
deviceChannel.setLongitudeGcj02(0.00);
|
||||
deviceChannel.setLatitudeGcj02(0.00);
|
||||
deviceChannel.setLongitudeWgs84(0.00);
|
||||
deviceChannel.setLatitudeWgs84(0.00);
|
||||
}
|
||||
}else {
|
||||
deviceChannel.setLongitudeGcj02(deviceChannel.getLongitude());
|
||||
deviceChannel.setLatitudeGcj02(deviceChannel.getLatitude());
|
||||
deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude());
|
||||
deviceChannel.setLatitudeWgs84(deviceChannel.getLatitude());
|
||||
}
|
||||
return deviceChannel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.genersoft.iot.vmp.gb28181.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.TreeType;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import org.dom4j.Attribute;
|
||||
@@ -400,6 +398,7 @@ public class XmlUtil {
|
||||
} else {
|
||||
deviceChannel.setLatitude(0.00);
|
||||
}
|
||||
|
||||
deviceChannel.setGpsTime(DateUtil.getNow());
|
||||
|
||||
|
||||
@@ -414,6 +413,7 @@ public class XmlUtil {
|
||||
} else {
|
||||
deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
|
||||
}
|
||||
|
||||
return deviceChannel;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user