| | |
| | | package com.ard.utils.tcp; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ard.alarm.radar.domain.ArdEquipRadar; |
| | | import com.ard.alarm.radar.domain.RadarAlarmInfo; |
| | | import com.ard.hiksdk.domain.alarmEventInfo; |
| | | import com.ard.utils.LonlatConver; |
| | | import com.ard.utils.SpringTool; |
| | | import com.ard.utils.mqtt.MqttConsumer; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import io.netty.channel.SimpleChannelInboundHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | import sun.nio.cs.ext.GBK; |
| | | |
| | | import javax.xml.bind.DatatypeConverter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ScheduledFuture; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @Description: tcp客户端处理 |
| | |
| | | @Slf4j(topic = "radar") |
| | | public class NettyTcpClientHandler extends SimpleChannelInboundHandler<ByteBuf> { |
| | | |
| | | private String host; |
| | | private Integer port; |
| | | private Double longitude; |
| | | private Double lagitude; |
| | | private String name; |
| | | |
| | | public NettyTcpClientHandler(ArdEquipRadar ardEquipRadar) { |
| | | this.host = ardEquipRadar.getIp(); |
| | | this.port = ardEquipRadar.getPort(); |
| | | this.longitude = ardEquipRadar.getLongitude(); |
| | | this.lagitude = ardEquipRadar.getLatitude(); |
| | | this.name=ardEquipRadar.getName(); |
| | | } |
| | | |
| | | private ChannelHandlerContext context; |
| | | private ScheduledFuture<?> heartbeatTask; |
| | | |
| | | @Override |
| | | protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) { |
| | | // 处理接收到的消息 |
| | |
| | | msg.getBytes(msg.readerIndex(), byteArray); |
| | | byte[] bytes = receiveCompletePacket(byteArray); |
| | | if (bytes != null) { |
| | | String hexString = DatatypeConverter.printHexBinary(bytes); |
| | | log.info(hexString); |
| | | // String hexString = DatatypeConverter.printHexBinary(bytes); |
| | | // log.info(hexString); |
| | | processData(bytes); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void channelActive(ChannelHandlerContext ctx) { |
| | | // 当客户端连接成功后,发送消息给服务器 |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | ByteBuf message = ctx.alloc().buffer(); |
| | | byte[] heart = {0x01, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00, (byte) 0x83, (byte) 0x88, 0x5d, 0x71, 0x01, 0x02, 0x00}; |
| | | String hexString = DatatypeConverter.printHexBinary(heart); |
| | | log.info("发送心跳:" + hexString); |
| | | message.writeBytes(heart); |
| | | ctx.writeAndFlush(message); |
| | | } |
| | | }; |
| | | Timer timer = new Timer(); |
| | | // timer.schedule(timerTask, 0, 6000); |
| | | context = ctx; |
| | | startHeartbeatTask();//开始发送心跳 |
| | | } |
| | | |
| | | /** |
| | | * 开始心跳任务 |
| | | */ |
| | | private void startHeartbeatTask() { |
| | | heartbeatTask = context.executor().scheduleAtFixedRate(() -> { |
| | | // 发送心跳消息 |
| | | ByteBuf message = context.alloc().buffer(); |
| | | byte[] heart = {0x01, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00, (byte) 0x83, (byte) 0x88, 0x5d, 0x71, 0x01, 0x02, 0x00}; |
| | | String hexString = DatatypeConverter.printHexBinary(heart); |
| | | log.info("发送心跳:" + hexString); |
| | | message.writeBytes(heart); |
| | | context.writeAndFlush(message); |
| | | |
| | | }, 0, 5, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 停止心跳任务 |
| | | */ |
| | | private void stopHeartbeatTask() { |
| | | if (heartbeatTask != null) { |
| | | heartbeatTask.cancel(false); |
| | | heartbeatTask = null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { |
| | | log.error("连接异常"); |
| | | log.info("tcp客户端连接异常"); |
| | | // 发生异常时的处理 |
| | | cause.printStackTrace(); |
| | | ctx.close(); |
| | | stopHeartbeatTask();//停止心跳发送 |
| | | } |
| | | |
| | | public static void processData(byte[] data) { |
| | | /** |
| | | * 解析报警数据 |
| | | */ |
| | | public void processData(byte[] data) { |
| | | try { |
| | | data = transferData(data);//去掉包头和包尾及转义 |
| | | String s = DatatypeConverter.printHexBinary(data); |
| | | log.info(s); |
| | | byte[] type = Arrays.copyOfRange(data, index.type[0], index.type[1]);//命令类型 |
| | | data = transferData(data);//去掉包头和包尾、校验及转义 |
| | | |
| | | byte[] type = Arrays.copyOfRange(data, 0, 1);//命令类型 |
| | | log.info("命令类型:" + DatatypeConverter.printHexBinary(type)); |
| | | |
| | | byte[] cmdId = Arrays.copyOfRange(data, index.funcc[0], index.funcc[1]);//命令ID |
| | | byte[] cmdId = Arrays.copyOfRange(data, 1, 2);//命令ID |
| | | log.info("命令ID:" + DatatypeConverter.printHexBinary(cmdId)); |
| | | |
| | | byte[] payloadSize = Arrays.copyOfRange(data, index.payloadSize[0], index.payloadSize[1]);//有效负载大小 |
| | | // log.info("有效负载大小:" + DatatypeConverter.printHexBinary(payloadSize)); |
| | | byte[] payloadSize = Arrays.copyOfRange(data, 2, 4);//有效负载大小 |
| | | payloadSize = toLittleEndian(payloadSize); |
| | | // log.info("有效负载大小(转小端):" + DatatypeConverter.printHexBinary(payloadSize)); |
| | | int payloadSizeToDecimal = byteArrayToDecimal(payloadSize); |
| | | log.info("有效负载大小(转整型):" + payloadSizeToDecimal); |
| | | |
| | | if (Arrays.equals(cmdId, new byte[]{0x01})) { |
| | | byte[] dwTim = Arrays.copyOfRange(data, index.dwTim[0], index.dwTim[1]); |
| | | // log.info("周视图像的出现时间:" + DatatypeConverter.printHexBinary(dwTim)); |
| | | byte[] dwTim = Arrays.copyOfRange(data, 4, 8); |
| | | dwTim = toLittleEndian(dwTim); |
| | | // log.info("周视图像的出现时间(转小端):" + DatatypeConverter.printHexBinary(dwTim)); |
| | | // log.info("周视图像的出现时间(转整型):" + byteArrayToDecimal(dwTim)); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | long l = byteArrayToDecimal(dwTim); |
| | | String format = sdf.format(l * 1000); |
| | | log.info("周视图像的出现时间(转date):" + format); |
| | | String alarmTime = sdf.format(l * 1000); |
| | | log.info("周视图像的出现时间(转date):" + alarmTime); |
| | | |
| | | byte[] wTargetNum = Arrays.copyOfRange(data, index.wTargetNum[0], index.wTargetNum[1]); |
| | | byte[] wTargetNum = Arrays.copyOfRange(data, 8, 10); |
| | | wTargetNum = toLittleEndian(wTargetNum); |
| | | // log.info("目标总点数(转小端):" + DatatypeConverter.printHexBinary(wTargetNum)); |
| | | int targetNum = byteArrayToDecimal(wTargetNum); |
| | | log.info("目标总点数(转整型):" + targetNum); |
| | | |
| | | //解析NET_TARGET_UNIT(64是NET_TARGET_HEAD的字节数) |
| | | int unitIndex = index.acRes[1]; |
| | | log.info("有效负载无头起始位:" + unitIndex); |
| | | |
| | | // byte datum = data[unitIndex]; |
| | | // log.info("无头起始字节:" + SpringTool.byteToHex(datum)); |
| | | int UNITNum = (payloadSizeToDecimal - 64) / targetNum; |
| | | log.info("单个Unit大小:" + UNITNum); |
| | | int uintSize = (payloadSizeToDecimal - 64) / targetNum; |
| | | log.info("单条报警大小:" + uintSize); |
| | | for (int i = 0; i < targetNum; i++) { |
| | | Integer index = unitIndex + UNITNum * i; |
| | | |
| | | Integer index = 68 + uintSize * i; |
| | | byte[] dwID = Arrays.copyOfRange(data, index, index + 4); |
| | | dwID = toLittleEndian(dwID); |
| | | // log.info("dwID:" + DatatypeConverter.printHexBinary(dwID)); |
| | | int id = byteArrayToDecimal(dwID); |
| | | log.info("目标ID号:" + id); |
| | | |
| | | byte[] dwGSum = Arrays.copyOfRange(data, index + 4, index + 8); |
| | | dwGSum = toLittleEndian(dwGSum); |
| | | int GSum = byteArrayToDecimal(dwGSum); |
| | | log.info("目标当前像素灰度和:" + GSum); |
| | | // log.info("目标ID号:" + id); |
| | | |
| | | byte[] iDistance = Arrays.copyOfRange(data, index + 8, index + 12); |
| | | iDistance = toLittleEndian(iDistance); |
| | | int Distance = byteArrayToDecimal(iDistance); |
| | | log.info("目标当前距离(m):" + Distance); |
| | | |
| | | byte[] iTw = Arrays.copyOfRange(data, index + 12, index + 16); |
| | | iTw = toLittleEndian(iTw); |
| | | int Tw = byteArrayToDecimal(iTw); |
| | | log.info("目标当前的像素宽度:" + Tw); |
| | | |
| | | byte[] iTh = Arrays.copyOfRange(data, index + 16, index + 20); |
| | | iTh = toLittleEndian(iTh); |
| | | int Th = byteArrayToDecimal(iTh); |
| | | log.info("目标当前的像素高度:" + Th); |
| | | |
| | | byte[] wPxlArea = Arrays.copyOfRange(data, index + 20, index + 22); |
| | | wPxlArea = toLittleEndian(wPxlArea); |
| | | int PxlArea = byteArrayToDecimal(wPxlArea); |
| | | log.info("目标当前像素面积:" + PxlArea); |
| | | |
| | | byte[] cTrkNum = Arrays.copyOfRange(data, index + 22, index + 23); |
| | | cTrkNum = toLittleEndian(cTrkNum); |
| | | int TrkNum = byteArrayToDecimal(cTrkNum); |
| | | log.info("轨迹点数:" + TrkNum); |
| | | |
| | | byte[] cStat = Arrays.copyOfRange(data, index + 23, index + 24); |
| | | cStat = toLittleEndian(cStat); |
| | | int Stat = byteArrayToDecimal(cStat); |
| | | log.info("目标当前状态:" + Stat); |
| | | |
| | | byte[] sVx = Arrays.copyOfRange(data, index + 24, index + 26); |
| | | sVx = toLittleEndian(sVx); |
| | | int Vx = byteArrayToDecimal(sVx); |
| | | log.info("目标当前速度矢量(像素距离)X:" + Vx); |
| | | |
| | | byte[] sVy = Arrays.copyOfRange(data, index + 26, index + 28); |
| | | sVy = toLittleEndian(sVy); |
| | | int Vy = byteArrayToDecimal(sVy); |
| | | log.info("目标当前速度矢量(像素距离)Y:" + Vy); |
| | | |
| | | byte[] sAreaNo = Arrays.copyOfRange(data, index + 28, index + 30); |
| | | sAreaNo = toLittleEndian(sAreaNo); |
| | | int AreaNo = byteArrayToDecimal(sAreaNo); |
| | | log.info("目标归属的告警区域号:" + AreaNo); |
| | | |
| | | byte[] cGrp = Arrays.copyOfRange(data, index + 30, index + 31); |
| | | cGrp = toLittleEndian(cGrp); |
| | | int Grp = byteArrayToDecimal(cGrp); |
| | | log.info("所属组:" + Grp); |
| | | |
| | | // log.info("目标当前距离(m):" + Distance); |
| | | //region 不需要的字段 |
| | | // byte[] dwGSum = Arrays.copyOfRange(data, index + 4, index + 8); |
| | | // dwGSum = toLittleEndian(dwGSum); |
| | | // int GSum = byteArrayToDecimal(dwGSum); |
| | | // log.info("目标当前像素灰度和:" + GSum); |
| | | // byte[] iTw = Arrays.copyOfRange(data, index + 12, index + 16); |
| | | // iTw = toLittleEndian(iTw); |
| | | // int Tw = byteArrayToDecimal(iTw); |
| | | // log.info("目标当前的像素宽度:" + Tw); |
| | | // |
| | | // byte[] iTh = Arrays.copyOfRange(data, index + 16, index + 20); |
| | | // iTh = toLittleEndian(iTh); |
| | | // int Th = byteArrayToDecimal(iTh); |
| | | // log.info("目标当前的像素高度:" + Th); |
| | | // |
| | | // byte[] wPxlArea = Arrays.copyOfRange(data, index + 20, index + 22); |
| | | // wPxlArea = toLittleEndian(wPxlArea); |
| | | // int PxlArea = byteArrayToDecimal(wPxlArea); |
| | | // log.info("目标当前像素面积:" + PxlArea); |
| | | // |
| | | // byte[] cTrkNum = Arrays.copyOfRange(data, index + 22, index + 23); |
| | | // cTrkNum = toLittleEndian(cTrkNum); |
| | | // int TrkNum = byteArrayToDecimal(cTrkNum); |
| | | // log.info("轨迹点数:" + TrkNum); |
| | | // |
| | | // byte[] cStat = Arrays.copyOfRange(data, index + 23, index + 24); |
| | | // cStat = toLittleEndian(cStat); |
| | | // int Stat = byteArrayToDecimal(cStat); |
| | | // log.info("目标当前状态:" + Stat); |
| | | // |
| | | // byte[] sVx = Arrays.copyOfRange(data, index + 24, index + 26); |
| | | // sVx = toLittleEndian(sVx); |
| | | // int Vx = byteArrayToDecimal(sVx); |
| | | // log.info("目标当前速度矢量(像素距离)X:" + Vx); |
| | | // |
| | | // byte[] sVy = Arrays.copyOfRange(data, index + 26, index + 28); |
| | | // sVy = toLittleEndian(sVy); |
| | | // int Vy = byteArrayToDecimal(sVy); |
| | | // log.info("目标当前速度矢量(像素距离)Y:" + Vy); |
| | | // |
| | | // byte[] sAreaNo = Arrays.copyOfRange(data, index + 28, index + 30); |
| | | // sAreaNo = toLittleEndian(sAreaNo); |
| | | // int AreaNo = byteArrayToDecimal(sAreaNo); |
| | | // log.info("目标归属的告警区域号:" + AreaNo); |
| | | // |
| | | // byte[] cGrp = Arrays.copyOfRange(data, index + 30, index + 31); |
| | | // cGrp = toLittleEndian(cGrp); |
| | | // int Grp = byteArrayToDecimal(cGrp); |
| | | // log.info("所属组:" + Grp); |
| | | //endregion |
| | | byte[] szName = Arrays.copyOfRange(data, index + 64, index + 96); |
| | | String str = new String(szName, "GBK"); |
| | | log.info("所属告警区域名称:" + str); |
| | | int position = findIndexOfDoubleZero(szName); |
| | | String alarmPointName = ""; |
| | | if (position != -1) { |
| | | byte[] result = new byte[position]; |
| | | System.arraycopy(szName, 0, result, 0, position); |
| | | alarmPointName = new String(result, "GBK"); |
| | | } else { |
| | | alarmPointName = new String(szName, "GBK"); |
| | | } |
| | | // log.info("所属告警区域名称:" + alarmPointName); |
| | | byte[] afTx = Arrays.copyOfRange(data, index + 96, index + 100); |
| | | afTx = toLittleEndian(afTx); |
| | | float fTx = bytesToFloat(afTx); |
| | | // log.info("水平角度:" + fTx); |
| | | byte[] afTy = Arrays.copyOfRange(data, index + 112, index + 116); |
| | | afTy = toLittleEndian(afTy); |
| | | float fTy = bytesToFloat(afTy); |
| | | // log.info("垂直角度:" + fTy); |
| | | log.info("雷达信息:" + host + "【port】" + port + "【X】" + longitude + "【Y】" + lagitude); |
| | | Double[] radarXY = {longitude, lagitude}; |
| | | Double[] alarmXY = CalculateCoordinates(radarXY, Distance, (double) fTx); |
| | | log.info("报警信息:" + "【id】" + id + "【name】" + alarmPointName + "【alarmTime】" + alarmTime + "【distance】" + Distance + "【P】" + fTx + "【T】" + fTy + "【X】" + alarmXY[0] + "【Y】" + alarmXY[1]); |
| | | RadarAlarmInfo alarmInfo=new RadarAlarmInfo(); |
| | | alarmInfo.setId(id); |
| | | alarmInfo.setAlarmTime(alarmTime); |
| | | alarmInfo.setName(alarmPointName+"("+name+")"); |
| | | alarmInfo.setLongitude(alarmXY[0]); |
| | | alarmInfo.setLagitude(alarmXY[1]); |
| | | MqttConsumer.publish(2, false, "radar", JSON.toJSONString(alarmInfo)); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage()); |
| | | } |
| | | } |
| | | /** |
| | | * byte数组转float |
| | | */ |
| | | private float bytesToFloat(byte[] bytes) { |
| | | ByteBuffer buffer = ByteBuffer.wrap(bytes); |
| | | return buffer.getFloat(); |
| | | } |
| | | |
| | | public static int byteArrayToDecimal(byte[] byteArray) { |
| | | |
| | | /** |
| | | * byte数组转整型 |
| | | */ |
| | | public int byteArrayToDecimal(byte[] byteArray) { |
| | | int decimalValue = 0; |
| | | |
| | | for (int i = 0; i < byteArray.length; i++) { |
| | |
| | | return decimalValue; |
| | | } |
| | | |
| | | public static byte[] toLittleEndian(byte[] bigEndianBytes) { |
| | | /** |
| | | * 大端转小端 |
| | | */ |
| | | public byte[] toLittleEndian(byte[] bigEndianBytes) { |
| | | byte[] littleEndianBytes = new byte[bigEndianBytes.length]; |
| | | |
| | | for (int i = 0; i < bigEndianBytes.length; i++) { |
| | |
| | | } |
| | | |
| | | |
| | | public static Integer processPayloadSize(String payloadSize) {//解析有效负载大小 |
| | | Integer payloadSizeInfo = 0; |
| | | String[] payloadSizeArr = payloadSize.split(""); |
| | | for (int i = 0; i <= payloadSizeArr.length - 1; i++) { |
| | | Integer num = null; |
| | | switch (payloadSizeArr[i]) { |
| | | case "0": |
| | | num = 0; |
| | | break; |
| | | case "1": |
| | | num = 1; |
| | | break; |
| | | case "2": |
| | | num = 2; |
| | | break; |
| | | case "3": |
| | | num = 3; |
| | | break; |
| | | case "4": |
| | | num = 4; |
| | | break; |
| | | case "5": |
| | | num = 5; |
| | | break; |
| | | case "6": |
| | | num = 6; |
| | | break; |
| | | case "7": |
| | | num = 7; |
| | | break; |
| | | case "8": |
| | | num = 8; |
| | | break; |
| | | case "9": |
| | | num = 9; |
| | | break; |
| | | case "a": |
| | | num = 10; |
| | | break; |
| | | case "b": |
| | | num = 11; |
| | | break; |
| | | case "c": |
| | | num = 12; |
| | | break; |
| | | case "d": |
| | | num = 13; |
| | | break; |
| | | case "e": |
| | | num = 14; |
| | | break; |
| | | case "f": |
| | | num = 15; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (i % 2 == 0) { |
| | | payloadSizeInfo = payloadSizeInfo + num * 16; |
| | | } else { |
| | | payloadSizeInfo = payloadSizeInfo + num * 256; |
| | | } |
| | | } |
| | | return payloadSizeInfo; |
| | | } |
| | | |
| | | public static Boolean checkPayloadSize(Integer payloadSizeInfo, String data) {//校验有效负载大小 |
| | | Integer payloadSize = (data.length() - 8 - 8) / 2;//去除包头8位和校验8位 |
| | | if (payloadSize.equals(payloadSizeInfo)) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 创建缓冲区列表 |
| | | List<Byte> buffer = new ArrayList<>(); |
| | | |
| | | /** |
| | | * 接收完整包 |
| | | */ |
| | | public byte[] receiveCompletePacket(byte[] receivedData) { |
| | | // 定义包尾字节序列 |
| | | byte[] packetEnd = {0x01, 0x02, 0x00}; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static int findPacketEndIndex(List<Byte> buffer, byte[] packetEnd) { |
| | | /** |
| | | * 获取包结束索引 |
| | | */ |
| | | public int findPacketEndIndex(List<Byte> buffer, byte[] packetEnd) { |
| | | for (int i = 0; i <= buffer.size() - packetEnd.length; i++) { |
| | | boolean isMatch = true; |
| | | for (int j = 0; j < packetEnd.length; j++) { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | public static byte[] extractPacketFromBuffer(List<Byte> buffer, int endIndex) { |
| | | /** |
| | | * 从缓冲区提取数据包 |
| | | */ |
| | | public byte[] extractPacketFromBuffer(List<Byte> buffer, int endIndex) { |
| | | byte[] packet = new byte[endIndex]; |
| | | for (int i = 0; i < endIndex; i++) { |
| | | packet[i] = buffer.get(i); |
| | |
| | | return packet; |
| | | } |
| | | |
| | | //去掉包头和包尾校验及转义 |
| | | public static byte[] transferData(byte[] data) { |
| | | /** |
| | | * 去掉包头和包尾校验及转义 |
| | | */ |
| | | public byte[] transferData(byte[] data) { |
| | | data = Arrays.copyOfRange(data, 3, data.length); |
| | | data = Arrays.copyOfRange(data, 0, data.length - 7); |
| | | String dataStr = DatatypeConverter.printHexBinary(data); |
| | |
| | | data = DatatypeConverter.parseHexBinary(dataStr); |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * 找到00的索引位置 |
| | | */ |
| | | private int findIndexOfDoubleZero(byte[] bytes) { |
| | | for (int i = 0; i < bytes.length - 1; i++) { |
| | | if (bytes[i] == 0x00) { |
| | | return i; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 通过A点坐标,长度和Y轴角度计算B点坐标 |
| | | */ |
| | | public Double[] CalculateCoordinates(Double[] radarCoordinates, Integer distance, Double angle) { |
| | | double[] to_wgs84 = LonlatConver.gcj02_To_Wgs84(radarCoordinates[0], radarCoordinates[1]); |
| | | double Ax = to_wgs84[0]; // A 点的 X 坐标 |
| | | double Ay = to_wgs84[1]; // A 点的 Y 坐标 |
| | | double AB = distance; // AB 的长度 |
| | | double angleWithYAxisDegrees = angle; // AB 与 Y 轴的角度(以度数表示) |
| | | GeodeticCalculator calculator = new GeodeticCalculator(); |
| | | GlobalCoordinates globalCoordinates = new GlobalCoordinates(Ay, Ax); |
| | | GlobalCoordinates globalCoordinates1 = calculator.calculateEndingGlobalCoordinates(Ellipsoid.WGS84, globalCoordinates, angleWithYAxisDegrees, AB); |
| | | return new Double[]{globalCoordinates1.getLongitude(), globalCoordinates1.getLatitude()}; |
| | | } |
| | | |
| | | } |