From 893998916eab354d4002fbcdcb0a242a36a49684 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 18 七月 2024 11:28:14 +0800
Subject: [PATCH] 3

---
 src/main/java/com/se/simu/service/WaterService.java |   63 +++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/se/simu/service/WaterService.java b/src/main/java/com/se/simu/service/WaterService.java
index 9e44a25..f5dd5ec 100644
--- a/src/main/java/com/se/simu/service/WaterService.java
+++ b/src/main/java/com/se/simu/service/WaterService.java
@@ -5,6 +5,8 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -23,6 +25,51 @@
 
     @Value("${sys.path.data}")
     String dataPath;
+
+    /**
+     * 鑾峰彇鍏冩暟鎹俊鎭�
+     */
+    public byte[] getLayerJson(String serviceName) {
+        try {
+            String filePath = dataPath + File.separator + serviceName + File.separator + "layer.json";
+
+            File dat = new File(filePath);
+            if (!dat.exists()) {
+                return null;
+            }
+
+            byte[] bytes = new byte[(int) dat.length()];
+
+            FileInputStream fs = new FileInputStream(filePath);
+            fs.read(bytes);
+            fs.close();
+
+            return bytes;
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+    /**
+     * 鑾峰彇鍦板舰楂樺害鍥�
+     */
+    public String getTerraMap(String serviceName, Integer width, Integer height) {
+        return dataPath + File.separator + serviceName + File.separator + "terrain" + File.separator + width + "_" + height + ".png";
+    }
+
+    /**
+     * 鑾峰彇姘撮潰楂樺害鍥�
+     */
+    public String getWaterMap(String serviceName, Integer width, Integer height, Long timestamp) {
+        return dataPath + 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 dataPath + File.separator + serviceName + File.separator + "flow" + File.separator + timestamp+ File.separator + width + "_" + height + ".png";
+    }
 
     public Layer getLayer(String serviceName) {
         Layer layer = new Layer();
@@ -43,21 +90,5 @@
         layer.setWaters(new Water(data));
 
         return layer;
-    }
-
-    public String getTerraMap(String serviceName, Integer width, Integer height) {
-        return "D:/simu/test/geo.png";
-    }
-
-    public String getWaterMap(String serviceName, Integer width, Integer height) {
-        return null;
-    }
-
-    public String getFlowMap(String serviceName, Integer width, Integer height, Long timestamp) {
-        //com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
-
-
-
-        return null;
     }
 }

--
Gitblit v1.9.3