1
13693261870
2024-10-08 2ecba122da738bcee26e27a1bd0f06e6c7c7f690
1
已修改1个文件
17 ■■■■■ 文件已修改
src/main/java/com/se/simu/service/ResultService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/ResultService.java
@@ -1,7 +1,7 @@
package com.se.simu.service;
import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.domain.dto.ExtensionDto;
import com.se.simu.domain.dto.LayerDto;
@@ -160,7 +160,7 @@
            //band.ReadRaster(0, 0, width, height, buffer, width, height, 0, 0);
            band.ReadRaster(0, 0, width, height, buffer);
            BufferedImage image = createImage(width, height);
            BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
            double differ = layer.getExtension().getMaxHeight() - layer.getExtension().getMinHeight(), minHeight = layer.getExtension().getMinHeight();
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
@@ -257,6 +257,7 @@
    private static List<String> getFiles(String path, String suffix) {
        List<String> files = new ArrayList<>();
        getFiles(files, new File(path), suffix);
        files.sort((a, b) -> a.compareToIgnoreCase(b));
        return files;
    }
@@ -367,7 +368,7 @@
            band.ReadRaster(0, 0, width, height, buffer);
            float[] building = dto.getBuildings().get(width + "_" + height);
            BufferedImage image = createImage(width, height);
            BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
            double differ = layer.getExtension().getMaxHeight() - layer.getExtension().getMinHeight(), minHeight = layer.getExtension().getMinHeight();
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
@@ -399,8 +400,8 @@
        List<String> vyFiles = new ArrayList<>();
        List<String> files = getFiles(dto.getFlowPath(), ".tif");
        for (String file : files) {
            if (file.startsWith("vx")) vxFiles.add(file);
            if (file.startsWith("vy")) vyFiles.add(file);
            if (file.contains(File.separator + "vx")) vxFiles.add(file);
            if (file.contains(File.separator + "vy")) vyFiles.add(file);
        }
        if (null == vxFiles || null == vyFiles || vxFiles.size() != vyFiles.size() || vxFiles.size() != layer.getWaters().getData().size())
            return;
@@ -460,7 +461,7 @@
    }
    private static void createFlowPng(float[] vxBuffer, float[] vyBuffer, String png, int width, int height) {
        BufferedImage image = createImage(width, height);
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        // 用 R通道表示,流向为归一化的二维向量(x,y),G通道表示为 x *255 , B通道表示为 y * 255
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
@@ -499,7 +500,9 @@
     * 元数据
     */
    private void copeLayerJson(ResultDto dto, LayerDto layer) throws IOException {
        String json = JSONUtil.toJsonPrettyStr(layer);
        layer.getWaters().setFiles(null);
        //String json = JSONUtil.toJsonPrettyStr(layer);
        String json = JSON.toJSONString(layer);
        String filePath = dto.getOutPath() + File.separator + "layer.json";
        FileWriter fw = new FileWriter(filePath);