From 1f6fafd5c0d26ac863e7d48b40c802fa962b07cb Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Sat, 07 Mar 2026 15:39:48 +0800
Subject: [PATCH] 1. 修改生成kmz文件核心代码,海拔高度相关信息。

---
 ard-route/src/main/java/com/ard/route/util/ToolUtils.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ard-route/src/main/java/com/ard/route/util/ToolUtils.java b/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
index 51b2401..dcab57b 100644
--- a/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
+++ b/ard-route/src/main/java/com/ard/route/util/ToolUtils.java
@@ -1,10 +1,11 @@
 package com.ard.route.util;
 
+import com.ard.inspection.domain.ArdPointCloud;
 import com.ard.route.domain.djuav.UavRouteReq;
-
 import java.io.*;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.List;
 
 /**
  * 工具类
@@ -86,6 +87,9 @@
 
     // 对象序列化为字节数组
     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);
@@ -98,6 +102,13 @@
         try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
              ObjectInputStream ois = new ObjectInputStream(bais)) {
             return ois.readObject();
+        }
+    }
+
+    public static List<ArdPointCloud> deserializeLs(byte[] data) throws IOException, ClassNotFoundException {
+        try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
+             ObjectInputStream ois = new ObjectInputStream(bais)) {
+            return (List<ArdPointCloud>) ois.readObject();
         }
     }
 
@@ -129,9 +140,12 @@
 
     /**
      * 截取字符串
-     * 获取经纬度
+     * 获取经纬度高度
      */
     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());
@@ -139,6 +153,9 @@
         if ("lat".equals(type)){
             return Double.parseDouble(parts[1].trim());
         }
+        if ("alt".equals(type)){
+            return Double.parseDouble(parts[2].trim());
+        }
         return null;
     }
 

--
Gitblit v1.9.3