瀏覽代碼

修改quadTree 返回值静态变量的错误

wuweihao 4 年之前
父節點
當前提交
6a819e0ac6

+ 10 - 7
laser/src/main/java/com/fdkankan/indoor/base/convert/quadTree/Solution.java

@@ -2,14 +2,11 @@ package com.fdkankan.indoor.base.convert.quadTree;
 
 import java.io.File;
 
-//import com.tree.my.Node;
-//import com.tree.my.Solution;
 
-//com.quadTree.
 
 /**
  * 四叉树算法
- *
+ * 2021-09-08
  * 返回值是全局, 调用是要new对象使用
  */
 public class Solution {
@@ -19,8 +16,12 @@ public class Solution {
 //	public static String QUADTREE = "";
 	//public static int MaxDepth = 0;
 
-	// 返回值
-	private static String quadTree = "";
+	// 返回值 ,
+	/**
+	 * 返回值
+	 * 不能是静态变量
+	 */
+	private String quadTree = "";
 
 
 	//val      当前点是否有值
@@ -205,12 +206,14 @@ public class Solution {
 
 
 	public static void main(String args[]) {
-		String path = "F:\\test\\ngin\\age_laser_data\\w-60\\results\\laserData\\cover\\0";
+		String path = "F:\\test\\ngin\\age_laser_data\\w-60\\results\\laserData\\cover\\3";
 		Solution solution = new Solution();
 		File file = solution.readFiles(path);
 		if(file!=null) {
 			String xyTiles = solution.getXYTiles(file);
 			// tiledMap.Quadtree("fccf7fffcff3bf7f") 的值;
+
+			// fac25cff1f51
 			System.out.println("quadTree:" + xyTiles);
 
 		}

+ 6 - 0
laser/src/main/java/com/fdkankan/indoor/core/controller/TestController.java

@@ -237,6 +237,12 @@ public class TestController {
         return Result.success();
     }
 
+    @ApiOperation("tiledMapQuadTree")
+    @GetMapping("tiledMapInit/QuadTree")
+    public Result tiledMapQuadTree(){
+        return owenService.testQuadTree();
+    }
+
 
     @ApiOperation("specialPoint-查询特殊点")
     @GetMapping("specialPoint/{sceneCode}")

+ 2 - 0
laser/src/main/java/com/fdkankan/indoor/core/service/OwenService.java

@@ -35,4 +35,6 @@ public interface OwenService {
     Result mergeInfoRemove(String sceneCode, Integer dataSetId);
 
     Result ossExist();
+
+    Result testQuadTree();
 }

+ 16 - 0
laser/src/main/java/com/fdkankan/indoor/core/service/impl/OwenServiceImpl.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.indoor.base.constant.CmdConstant;
 import com.fdkankan.indoor.base.constant.ConfigConstant;
 import com.fdkankan.indoor.base.constant.TypeConstant;
+import com.fdkankan.indoor.base.convert.quadTree.Solution;
 import com.fdkankan.indoor.base.exception.BaseRuntimeException;
 import com.fdkankan.indoor.base.util.AliYunOssUtil;
 import com.fdkankan.indoor.base.util.CmdUtils;
@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
@@ -229,6 +231,20 @@ public class OwenServiceImpl implements OwenService {
         return Result.success(exist);
     }
 
+    @Override
+    public Result testQuadTree(){
+        String dirPath = "F:\\test\\ngin\\age_laser_data\\w-60\\results\\laserData\\cover\\3";
+        log.info("quadTree dirPath: {}", dirPath);
+        Solution solution = new Solution();
+        File file = solution.readFiles(dirPath);
+        String quadTree = "";
+        if(file!=null) {
+            quadTree = solution.getXYTiles(file);
+        }
+        log.info("quadTree : {}", quadTree);
+        return Result.success(quadTree);
+    }
+
 
     private String redisPath(String sceneCode) {
         String initKey = TypeConstant.REDIS_INIT_PATH + sceneCode;

+ 1 - 0
laser/src/main/java/com/fdkankan/indoor/core/service/impl/TiledMapServiceImpl.java

@@ -362,6 +362,7 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
         // cover压缩上传oss, 提供平面图下载, 存放在data/sceneCode/upload_cover
         String outPath = path + "/upload_cover/cover.zip";
         log.info("cover.zip path: {}", outPath);
+        // withSrcDir: 压缩是否包含目录
         ZipUtil.zip(new File(outPath), false, new File(uploadDir));
         log.info("文件压缩成功: {}", outPath);