13693261870
2024-09-26 1e4cafb7b48c3aac7b6111ff496cac0a40807435
src/main/java/com/se/simu/service/WaterService.java
@@ -1,10 +1,11 @@
package com.se.simu.service;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.domain.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
@@ -20,18 +21,15 @@
@Slf4j
@Service
public class WaterService {
    @Value("${sys.ver}")
    String ver;
    @Value("${sys.path.out}")
    String outPath;
    @Resource
    PropertiesConfig config;
    /**
     * 获取元数据信息
     */
    public byte[] getLayerJson(String serviceName) {
        try {
            String filePath = outPath + File.separator + serviceName + File.separator + "layer.json";
            String filePath = config.getOutPath() + File.separator + serviceName + File.separator + "layer.json";
            File dat = new File(filePath);
            if (!dat.exists()) {
@@ -54,21 +52,21 @@
     * 获取地形高度图
     */
    public String getTerraMap(String serviceName, Integer width, Integer height) {
        return outPath + File.separator + serviceName + File.separator + "terrain" + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "terrain" + File.separator + width + "_" + height + ".png";
    }
    /**
     * 获取水面高度图
     */
    public String getWaterMap(String serviceName, Integer width, Integer height, Long timestamp) {
        return outPath + File.separator + serviceName + File.separator + "waters" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "waters" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
    }
    /**
     * 获取水流向流速图
     */
    public String getFlowMap(String serviceName, Integer width, Integer height, Long timestamp) {
        return outPath + File.separator + serviceName + File.separator + "flows" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "flows" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
    }
    /**
@@ -76,7 +74,7 @@
     */
    public Layer getLayer(String serviceName) {
        Layer layer = new Layer();
        layer.setVersion(ver);
        layer.setVersion(config.getVer());
        layer.setDuration(new Duration(1719812810225L, 1719812810225L));
        layer.setExtension(new Extension(2.11062743358, 0.53812160220, 2.11070827834, 0.53819799453, 1.151, 38.83));