1
13693261870
2024-09-30 60494b2aa2d720a98c421dc732ca2636b273e10c
1
已添加3个文件
已修改3个文件
299 ■■■■■ 文件已修改
src/main/java/com/se/simu/controller/SimuController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/DurationDto.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/ExtensionDto.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/ResultDto.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/ResultService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/UwService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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) {
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;
    }
}
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;
    }
}
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;
    }
}
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";
    }
}
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;
/**
 * å†…涝求解器服务类