From 60494b2aa2d720a98c421dc732ca2636b273e10c Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 30 九月 2024 17:02:17 +0800
Subject: [PATCH] 1

---
 src/main/java/com/se/simu/domain/dto/ResultDto.java      |  123 ++++++++++++++++++++++++
 src/main/java/com/se/simu/domain/dto/ExtensionDto.java   |   98 +++++++++++++++++++
 src/main/java/com/se/simu/service/ResultService.java     |   26 +++++
 src/main/java/com/se/simu/service/UwService.java         |    3 
 src/main/java/com/se/simu/domain/dto/DurationDto.java    |   37 +++++++
 src/main/java/com/se/simu/controller/SimuController.java |   12 +
 6 files changed, 291 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/se/simu/controller/SimuController.java b/src/main/java/com/se/simu/controller/SimuController.java
index e97b77d..8ee0441 100644
--- a/src/main/java/com/se/simu/controller/SimuController.java
+++ b/src/main/java/com/se/simu/controller/SimuController.java
@@ -8,6 +8,7 @@
 import com.se.simu.domain.vo.SimuVo;
 import com.se.simu.helper.StringHelper;
 import com.se.simu.service.GedbService;
+import com.se.simu.service.ResultService;
 import com.se.simu.service.SimuService;
 import io.swagger.annotations.*;
 import lombok.extern.slf4j.Slf4j;
@@ -33,6 +34,9 @@
 public class SimuController extends BaseController {
     @Resource
     GedbService gedbService;
+
+    @Resource
+    ResultService resultService;
 
     @Resource
     SimuService simuService;
@@ -145,10 +149,10 @@
     @GetMapping("/test")
     public R<Object> test() {
         try {
-            // 469538.6536261877,4416744.922022615,469853.14714664617,4417049.378602433
-            //String bbox = "116.64388473935195,39.884315914604464,116.64754729082588,39.887069143903496";
-            DataPo data = new DataPo("20240913", "20240913", "20240913", 116.64388473935195, 39.884315914604464, 116.64754729082588, 39.887069143903496, 50.0, 25);
-            Object rs = gedbService.test(data);
+            //DataPo data = new DataPo("20240913", "20240913", "20240913", 116.64388473935195, 39.884315914604464, 116.64754729082588, 39.887069143903496, 50.0, 25);
+            //Object rs = gedbService.test(data);
+
+            Object rs = resultService.test();
 
             return success(rs);
         } catch (Exception ex) {
diff --git a/src/main/java/com/se/simu/domain/dto/DurationDto.java b/src/main/java/com/se/simu/domain/dto/DurationDto.java
new file mode 100644
index 0000000..09f055a
--- /dev/null
+++ b/src/main/java/com/se/simu/domain/dto/DurationDto.java
@@ -0,0 +1,37 @@
+package com.se.simu.domain.dto;
+
+/**
+ * 鎸佺画鏃堕棿瀹炰綋绫�
+ *
+ * @author WWW
+ * @date   2024-09-30
+ */
+public class DurationDto {
+    private long start;
+
+    private long end;
+
+    public DurationDto() {
+    }
+
+    public DurationDto(long start, long end) {
+        this.start = start;
+        this.end = end;
+    }
+
+    public long getStart() {
+        return start;
+    }
+
+    public void setStart(long start) {
+        this.start = start;
+    }
+
+    public long getEnd() {
+        return end;
+    }
+
+    public void setEnd(long end) {
+        this.end = end;
+    }
+}
diff --git a/src/main/java/com/se/simu/domain/dto/ExtensionDto.java b/src/main/java/com/se/simu/domain/dto/ExtensionDto.java
new file mode 100644
index 0000000..e1bd6a0
--- /dev/null
+++ b/src/main/java/com/se/simu/domain/dto/ExtensionDto.java
@@ -0,0 +1,98 @@
+package com.se.simu.domain.dto;
+
+/**
+ * 鑼冨洿瀹炰綋绫�
+ *
+ * @author WWW
+ * @date   2024-09-30
+ */
+public class ExtensionDto {
+    private double minx;
+
+    private double miny;
+
+    private double maxx;
+
+    private double maxy;
+
+    private double minHeight;
+
+    private double maxHeight;
+
+    public ExtensionDto(){}
+
+    public ExtensionDto(double minx, double miny, double maxx, double maxy) {
+        this.minx = minx;
+        this.miny = miny;
+        this.maxx = maxx;
+        this.maxy = maxy;
+    }
+
+    public ExtensionDto(double minx, double miny, double maxx, double maxy, double minHeight, double maxHeight) {
+        this.minx = minx;
+        this.miny = miny;
+        this.maxx = maxx;
+        this.maxy = maxy;
+        this.minHeight = minHeight;
+        this.maxHeight = maxHeight;
+    }
+
+    public void setHeight(double minHeight, double maxHeight) {
+        synchronized (this) {
+            if (this.minHeight > minHeight) {
+                this.minHeight = minHeight;
+            }
+            if (this.maxHeight < maxHeight) {
+                this.maxHeight = maxHeight;
+            }
+        }
+    }
+
+    public double getMinx() {
+        return minx;
+    }
+
+    public void setMinx(double minx) {
+        this.minx = minx;
+    }
+
+    public double getMiny() {
+        return miny;
+    }
+
+    public void setMiny(double miny) {
+        this.miny = miny;
+    }
+
+    public double getMaxx() {
+        return maxx;
+    }
+
+    public void setMaxx(double maxx) {
+        this.maxx = maxx;
+    }
+
+    public double getMaxy() {
+        return maxy;
+    }
+
+    public void setMaxy(double maxy) {
+        this.maxy = maxy;
+    }
+
+    public double getMinHeight() {
+        return minHeight;
+    }
+
+    public void setMinHeight(double minHeight) {
+        this.minHeight = minHeight;
+    }
+
+    public double getMaxHeight() {
+        return maxHeight;
+    }
+
+    public void setMaxHeight(double maxHeight) {
+        this.maxHeight = maxHeight;
+    }
+}
diff --git a/src/main/java/com/se/simu/domain/dto/ResultDto.java b/src/main/java/com/se/simu/domain/dto/ResultDto.java
new file mode 100644
index 0000000..af4e9dd
--- /dev/null
+++ b/src/main/java/com/se/simu/domain/dto/ResultDto.java
@@ -0,0 +1,123 @@
+package com.se.simu.domain.dto;
+
+import cn.hutool.core.io.FileUtil;
+
+import java.io.File;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 缁撴灉瀹炰綋绫�
+ *
+ * @author WWW
+ * @date 2024-09-30
+ */
+public class ResultDto {
+    private String serviceName;
+
+    private String terrainFile;
+
+    private String buildingFile;
+
+    private String waterPath;
+
+    private String flowPath;
+
+    private String outPath;
+
+    private String temp;
+
+    private Map<String, float[]> buildings;
+
+    public ResultDto() {
+        this.buildings = new HashMap<>();
+    }
+
+    public ResultDto(String serviceName, String terrainFile, String buildingFile, String waterPath, String flowPath, String outPath, String temp) {
+        this();
+        this.serviceName = serviceName;
+        this.terrainFile = terrainFile;
+        this.buildingFile = buildingFile;
+        this.waterPath = waterPath;
+        this.flowPath = flowPath;
+        this.outPath = outPath + File.separator + serviceName;
+        this.temp = outPath + File.separator + serviceName + File.separator + "temp";
+
+        File dir = new File(this.outPath);
+        if (dir.exists() && dir.isDirectory()) {
+            FileUtil.del(dir);
+        }
+        dir.mkdirs();
+
+        dir = new File(this.temp);
+        if (dir.exists() && dir.isDirectory()) {
+            FileUtil.del(dir);
+        }
+        dir.mkdirs();
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getTerrainFile() {
+        return terrainFile;
+    }
+
+    public void setTerrainFile(String terrainFile) {
+        this.terrainFile = terrainFile;
+    }
+
+    public String getBuildingFile() {
+        return buildingFile;
+    }
+
+    public void setBuildingFile(String buildingFile) {
+        this.buildingFile = buildingFile;
+    }
+
+    public String getWaterPath() {
+        return waterPath;
+    }
+
+    public void setWaterPath(String waterPath) {
+        this.waterPath = waterPath;
+    }
+
+    public String getFlowPath() {
+        return flowPath;
+    }
+
+    public void setFlowPath(String flowPath) {
+        this.flowPath = flowPath;
+    }
+
+    public String getOutPath() {
+        return outPath;
+    }
+
+    public void setOutPath(String outPath) {
+        this.outPath = outPath;
+    }
+
+    public String getTemp() {
+        return temp;
+    }
+
+    public void setTemp(String temp) {
+        this.temp = temp;
+    }
+
+    public Map<String, float[]> getBuildings() {
+        return buildings;
+    }
+
+    public void setBuildings(Map<String, float[]> buildings) {
+        this.buildings = buildings;
+    }
+}
diff --git a/src/main/java/com/se/simu/service/ResultService.java b/src/main/java/com/se/simu/service/ResultService.java
index 1905ce2..f270cac 100644
--- a/src/main/java/com/se/simu/service/ResultService.java
+++ b/src/main/java/com/se/simu/service/ResultService.java
@@ -1,7 +1,11 @@
 package com.se.simu.service;
 
+import com.se.simu.config.PropertiesConfig;
+import com.se.simu.domain.dto.ResultDto;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
 
 /**
  * 澶勭悊缁撴灉鏈嶅姟绫�
@@ -13,7 +17,27 @@
 @Service
 @SuppressWarnings("ALL")
 public class ResultService {
-    public void process() {
+    @Resource
+    PropertiesConfig config;
+
+    public final static double MAX_X_OFFSET = 0.002;
+
+
+    public void process(ResultDto dto) {
         //
     }
+
+    public String test() {
+        ResultDto dto = new ResultDto(
+                "202409",
+                "D:\\simu\\input\\tongzhou-local-mesh2-terrain.tif",
+                "D:\\simu\\input\\tongzhou-local-mesh2-buildings.tif",
+                "D:\\simu\\input\\waters",
+                "D:\\simu\\input\\flows",
+                "D:\\simu\\out",
+                "");
+        process(dto);
+
+        return "OK";
+    }
 }
diff --git a/src/main/java/com/se/simu/service/UwService.java b/src/main/java/com/se/simu/service/UwService.java
index 0385dc6..38756a7 100644
--- a/src/main/java/com/se/simu/service/UwService.java
+++ b/src/main/java/com/se/simu/service/UwService.java
@@ -1,7 +1,6 @@
 package com.se.simu.service;
 
 import cn.hutool.json.JSONUtil;
-import com.mathworks.toolbox.javabuilder.MWCharArray;
 import com.se.simu.config.PropertiesConfig;
 import com.se.simu.domain.dto.ConfigDto;
 import com.se.simu.domain.po.DataPo;
@@ -13,8 +12,6 @@
 
 import javax.annotation.Resource;
 import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * 鍐呮稘姹傝В鍣ㄦ湇鍔$被

--
Gitblit v1.9.3