| | |
| | | package com.ard.route.util; |
| | | |
| | | import com.ard.route.domain.djuav.UavRouteReq; |
| | | |
| | | import java.io.*; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | // 对象序列化为字节数组 |
| | | public static byte[] serialize(Object obj) throws IOException { |
| | | if (obj == null) { |
| | | return null; |
| | | } |
| | | try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | ObjectOutputStream oos = new ObjectOutputStream(baos)) { |
| | | oos.writeObject(obj); |
| | |
| | | |
| | | /** |
| | | * 截取字符串 |
| | | * 获取经纬度 |
| | | * 获取经纬度高度 |
| | | */ |
| | | public static Double getDoublePoint(String str,String type) { |
| | | if (str == null || str.isEmpty()) { |
| | | return null; |
| | | } |
| | | String[] parts = str.split(","); |
| | | if ("lon".equals(type)) { |
| | | return Double.parseDouble(parts[0].trim()); |
| | |
| | | if ("lat".equals(type)){ |
| | | return Double.parseDouble(parts[1].trim()); |
| | | } |
| | | if ("alt".equals(type)){ |
| | | return Double.parseDouble(parts[2].trim()); |
| | | } |
| | | return null; |
| | | } |
| | | |