1
13693261870
2024-11-02 e46790ae4ba029027d4d7784655b8a90234968ba
1
已修改2个文件
31 ■■■■■ 文件已修改
src/main/java/com/se/simu/domain/dto/ResultDto.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/ResultService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/ResultDto.java
@@ -1,6 +1,8 @@
package com.se.simu.domain.dto;
import cn.hutool.core.io.FileUtil;
import com.se.simu.helper.GdalHelper;
import org.gdal.osr.SpatialReference;
import java.io.File;
import java.util.*;
@@ -26,6 +28,10 @@
    private String temp;
    private int epsg;
    private SpatialReference spatialReference;
    private Map<String, float[]> buildings;
    private List<BuildingDto> buildingList;
@@ -35,7 +41,7 @@
        this.buildingList = new ArrayList<>();
    }
    public ResultDto(String serviceName, String terrainFile, String buildingFile, String waterPath, String flowPath, String outPath) {
    public ResultDto(String serviceName, String terrainFile, String buildingFile, String waterPath, String flowPath, String outPath, int epsg) {
        this();
        this.serviceName = serviceName;
        this.terrainFile = terrainFile;
@@ -44,6 +50,8 @@
        this.flowPath = flowPath;
        this.outPath = outPath + File.separator + serviceName;
        this.temp = outPath + File.separator + serviceName + File.separator + "temp";
        this.epsg = epsg;
        this.spatialReference = GdalHelper.createSpatialReference(epsg);
        File dir = new File(this.outPath);
        if (dir.exists() && dir.isDirectory()) {
@@ -129,4 +137,20 @@
    public void setBuildingList(List<BuildingDto> buildingList) {
        this.buildingList = buildingList;
    }
    public int getEpsg() {
        return epsg;
    }
    public void setEpsg(int epsg) {
        this.epsg = epsg;
    }
    public SpatialReference getSpatialReference() {
        return spatialReference;
    }
    public void setSpatialReference(SpatialReference spatialReference) {
        this.spatialReference = spatialReference;
    }
}
src/main/java/com/se/simu/service/ResultService.java
@@ -57,7 +57,8 @@
                basePath + config.getBuildingFile(),
                basePath + config.getWaterPath(),
                basePath + config.getFlowPath(),
                config.getOutPath());
                config.getOutPath(),
                data.getEpsg());
        LayerDto layer = new LayerDto(config.getVer(), data.getEpsg(), config.getSizes());
        process(dto, layer);
    }
@@ -350,6 +351,7 @@
            try {
                ds = gdal.Open(files.get(i), gdalconst.GA_ReadOnly);
                if (null == ds || 0 == ds.getRasterCount()) return;
                if (null == ds.GetSpatialRef()) ds.SetSpatialRef(dto.getSpatialReference());
                createWaterPng(dto, ds, layer, layer.getWaters().getData().get(i));
                copyWaterTif(dto, ds, layer.getWaters().getData().get(i));
@@ -448,6 +450,7 @@
            try {
                ds = gdal.Open(files.get(i), gdalconst.GA_ReadOnly);
                if (null == ds || 0 == ds.getRasterCount()) return;
                if (null == ds.GetSpatialRef()) ds.SetSpatialRef(dto.getSpatialReference());
                createFlowPng(dto, ds, layer, layer.getWaters().getData().get(i));
            } finally {