Prechádzať zdrojové kódy

添加 tiledMap基础数据代码

wuweihao 4 rokov pred
rodič
commit
142fa34c72

+ 1 - 0
laser/src/main/java/com/fdkankan/indoor/base/convert/PlanGraph.java

@@ -144,5 +144,6 @@ public class PlanGraph {
         // tiledMap 使用的值
         double[] orientation = _testMap.getQuaternion(angle);
         double map_size_m = _testMap.getSize(imgWidth,1);
+        System.out.println("");
     }
 }

+ 19 - 14
laser/src/main/java/com/fdkankan/indoor/base/convert/quadTree/Solution.java

@@ -9,6 +9,8 @@ import java.io.File;
 
 /**
  * 四叉树算法
+ *
+ * 返回值是全局, 调用是要new对象使用
  */
 public class Solution {
 
@@ -16,17 +18,18 @@ public class Solution {
 //	public static final String path = "F:\\2021\\navvis\\���Ի���\\laserData\\building_1\\map_tiles\\2\\3";
 //	public static String QUADTREE = "";
 	//public static int MaxDepth = 0;
-	
+
+	// 返回值
 	private static String quadTree = "";
 
 
 	//val      当前点是否有值
 	//isLeaf   是否是叶子节点,即:是否有儿子
-	public static Node construct(int[][] grid) {
+	public  Node construct(int[][] grid) {
         return find(grid,0,grid.length-1,0,grid.length-1);
     }
     
-    private static Node find(int[][] grid,int startrow,int endrow,int startcol,int endcol) {
+    private  Node find(int[][] grid,int startrow,int endrow,int startcol,int endcol) {
     	boolean val = grid[startrow][startcol] == 0?false:true;
     	Node root=null;
     	
@@ -50,7 +53,7 @@ public class Solution {
     	return root;
     }
     
-    private static boolean isLeaf(int[][] grid,int startrow,int endrow,int startcol,int endcol) {
+    private  boolean isLeaf(int[][] grid,int startrow,int endrow,int startcol,int endcol) {
     	//int now=grid[startrow][startcol];
     	if(startrow == endrow && startcol == endcol) {
 			//叶子节点
@@ -72,7 +75,7 @@ public class Solution {
     	return true;
     }
     
-    private static File readFiles(String inPath) {
+    private  File readFiles(String inPath) {
 		try {
 			File f = new File(inPath);
 			if(f.isDirectory()) {
@@ -89,7 +92,7 @@ public class Solution {
 		}
 	}
 
-	private static String getXYTiles(File f){
+	private  void getXYTiles(File f){
 		File[] files = f.listFiles();
 		String tiles = "";
 
@@ -121,14 +124,14 @@ public class Solution {
 		
 		Node node = construct(numthree);
 		String singleScore = getSingleScore(node);
-		System.out.println("singleScore: " + singleScore);
+//		System.out.println("singleScore: " + singleScore);
 		ouput(node);
 		// tiledMap.Quadtree("fccf7fffcff3bf7f") 的值;
-		System.out.println(quadTree);
-		return quadTree;
+//		System.out.println(quadTree);
+//		return quadTree;
 	}
 	
-	private static void ouput(Node node) {
+	private  void ouput(Node node) {
 		if(node.isLeaf) {
 			return;
 		}
@@ -152,7 +155,7 @@ public class Solution {
 		}
 	}
 	
-	private static String getSingleScore(Node node) {
+	private  String getSingleScore(Node node) {
 		int score = 0;
 		
 		if(node.topLeft!=null&&!node.topLeft.isLeaf) {
@@ -194,10 +197,12 @@ public class Solution {
 
 	public static void main(String args[]) {
 		String path = "F:\\test\\ngin\\age_laser_data\\w-60\\results\\laserData\\cover\\0";
-		File file = readFiles(path);
+		Solution solution = new Solution();
+		File file = solution.readFiles(path);
 		if(file!=null) {
-			String xyTiles = getXYTiles(file);
-			System.out.println("quadTree:" + xyTiles);
+			solution.getXYTiles(file);
+			// tiledMap.Quadtree("fccf7fffcff3bf7f") 的值;
+			System.out.println("quadTree:" + quadTree);
 		}
 	}
 }

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

@@ -10,6 +10,7 @@ import com.fdkankan.indoor.core.service.*;
 import com.fdkankan.indoor.core.entity.vo.HaoVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -22,11 +23,14 @@ import java.util.List;
  *
  * 建议使用场景码作为id, 因为他是主键
  */
+@Slf4j
 @Api(tags = "测试")
 @RestController
 @RequestMapping("test")
 public class TestController {
 
+    private static int variate = 0;
+
     @Autowired
     TestService testService;
 
@@ -45,6 +49,19 @@ public class TestController {
     @Autowired
     AliYunOssUtil aliYunOssUtil;
 
+    @ApiOperation("测试成员变量")
+    @GetMapping("testVariate/{param}")
+    public Result testVariate(@PathVariable Integer param){
+        log.info("前:{}",variate);
+        log.info("param:{}",param);
+        variate += param;
+        log.info("后:{}",variate);
+
+        return Result.success(variate);
+
+
+    }
+
     @ApiOperation("修改数据")
     @PostMapping("edit/{sceneCode}")
     public Result edit(@PathVariable String sceneCode, @RequestBody List<HaoVo> param){

+ 2 - 1
laser/src/main/java/com/fdkankan/indoor/core/service/impl/DataSetServiceImpl.java

@@ -219,7 +219,7 @@ public class DataSetServiceImpl extends IBaseServiceImpl implements DataSetServi
 
         // 合并结果
         List<JSONObject> mergeRoute = routeList.get(0);
-        // 信息写入数据库
+        // json转字符串, 信息写入数据库
         List<String> resultStr = convertToString(mergeRoute);
 
         RouteEntity routeEntity = routeService.findBySceneCode(sceneCode);
@@ -233,6 +233,7 @@ public class DataSetServiceImpl extends IBaseServiceImpl implements DataSetServi
         return Result.success();
     }
 
+    // json转字符串
     private static List<String> convertToString(List<JSONObject> param){
         List<String> mergeResult =  new ArrayList<>();
             for (JSONObject jon : param) {

+ 2 - 0
laser/src/main/java/com/fdkankan/indoor/test/Demo.java

@@ -17,6 +17,8 @@ public class Demo {
 
 
 
+
+
     @Test
     public void editFilter(){
         String path = "F:\\test\\age\\filter.json";