13693261870
2024-11-06 deeef732865c7dd901f07b7123e8f7a3c9f189c9
src/main/java/com/se/simu/service/ResultService.java
@@ -10,6 +10,7 @@
import com.se.simu.domain.po.DataPo;
import com.se.simu.domain.vo.BuildingDepthVo;
import com.se.simu.helper.GdalHelper;
import com.se.simu.helper.ShpHelper;
import lombok.extern.slf4j.Slf4j;
import org.gdal.gdal.Band;
import org.gdal.gdal.Dataset;
@@ -359,6 +360,7 @@
                createWaterPng(dto, ds, layer, layer.getWaters().getData().get(i));
                copyWaterTif(dto, ds, layer.getWaters().getData().get(i));
                createVectorShp(dto, ds, layer, layer.getWaters().getData().get(i));
            } finally {
                if (null != ds) ds.delete();
            }
@@ -379,12 +381,6 @@
            String png = waterPath + File.separator + sizes[0] + "_" + sizes[1] + ".png";
            water2Png(dto, layer, tif, png, sizes[0], sizes[1]);
        }
    }
    private static void copyWaterTif(ResultDto dto, Dataset ds, long ticks) {
        String source = ds.GetDescription();
        String target = dto.getOutPath() + File.separator + "waters" + File.separator + ticks + File.separator + "water.tif";
        FileUtil.copyFile(source, target);
    }
    private static String getNameWithExt(String file) {
@@ -502,6 +498,17 @@
        return !Double.isNaN(val) && val > Integer.MIN_VALUE;
    }
    private static void copyWaterTif(ResultDto dto, Dataset ds, long ticks) {
        String source = ds.GetDescription();
        String target = dto.getOutPath() + File.separator + "waters" + File.separator + ticks + File.separator + "water.tif";
        FileUtil.copyFile(source, target);
    }
    private static void createVectorShp(ResultDto dto, Dataset ds, LayerDto layer, Long ticks) {
        String shpFile = dto.getOutPath() + File.separator + "waters" + File.separator + ticks + File.separator + "water.shp";
        ShpHelper.polygonize(ds, shpFile);
    }
    private void copeFlow(ResultDto dto, LayerDto layer) {
        List<String> files = getFiles(dto.getFlowPath(), ".tif");
        if (null == files || files.size() != layer.getWaters().getData().size()) return;