From 25f8185028c5dc6eeb391e1d596aee6ce0c80d32 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 16 七月 2024 15:29:29 +0800 Subject: [PATCH] 添加图层类 --- src/main/java/com/se/simu/helper/WebHelper.java | 9 + src/main/java/com/se/simu/controller/WaterController.java | 5 src/main/java/com/se/simu/service/WaterService.java | 20 +++ src/main/resources/application-dev.yml | 2 src/main/resources/application-prod.yml | 34 +---- src/main/java/com/se/simu/domain/LayerVo.java | 251 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 292 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/se/simu/controller/WaterController.java b/src/main/java/com/se/simu/controller/WaterController.java index a901ca1..1e50750 100644 --- a/src/main/java/com/se/simu/controller/WaterController.java +++ b/src/main/java/com/se/simu/controller/WaterController.java @@ -1,5 +1,6 @@ package com.se.simu.controller; +import com.se.simu.domain.LayerVo; import com.se.simu.helper.StringHelper; import com.se.simu.helper.WebHelper; import com.se.simu.service.WaterService; @@ -49,7 +50,9 @@ return; } - // + LayerVo layer = waterService.getLayer(serviceName); + + WebHelper.writeJson2Page(res, HttpStatus.OK, layer); } catch (Exception ex) { log.error(ex.getMessage(), ex); WebHelper.writeStr2Page(res, HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage()); diff --git a/src/main/java/com/se/simu/domain/LayerVo.java b/src/main/java/com/se/simu/domain/LayerVo.java new file mode 100644 index 0000000..f58afa4 --- /dev/null +++ b/src/main/java/com/se/simu/domain/LayerVo.java @@ -0,0 +1,251 @@ +package com.se.simu.domain; + +import java.util.List; + +/** + * 鍥惧眰瑙嗗浘绫� + * + * @author WWW + * @date 2024-07-16 + */ +public class LayerVo { + String ver; + + Duration duration; + + Extension extension; + + Terrain terrain; + + Water water; + + public static class Duration { + long start; + + long end; + + public Duration() { + } + + public Duration(long start, long end) { + this.start = start; + this.end = end; + } + + public long getStart() { + return start; + } + + public void setStart(long start) { + this.start = start; + } + + public long getEnd() { + return end; + } + + public void setEnd(long end) { + this.end = end; + } + } + + public static class Extension { + double minx; + + double miny; + + double maxx; + + double maxy; + + double minHeight; + + double maxHeight; + + public Extension() { + } + + public Extension(double minx, double miny, double maxx, double maxy) { + this.minx = minx; + this.miny = miny; + this.maxx = maxx; + this.maxy = maxy; + } + + public Extension(double minHeight, double maxHeight) { + this.minHeight = minHeight; + this.maxHeight = maxHeight; + } + + public Extension(double minx, double miny, double maxx, double maxy, double minHeight, double maxHeight) { + this.minx = minx; + this.miny = miny; + this.maxx = maxx; + this.maxy = maxy; + this.minHeight = minHeight; + this.maxHeight = maxHeight; + } + + public double getMinx() { + return minx; + } + + public void setMinx(double minx) { + this.minx = minx; + } + + public double getMiny() { + return miny; + } + + public void setMiny(double miny) { + this.miny = miny; + } + + public double getMaxx() { + return maxx; + } + + public void setMaxx(double maxx) { + this.maxx = maxx; + } + + public double getMaxy() { + return maxy; + } + + public void setMaxy(double maxy) { + this.maxy = maxy; + } + + public double getMinHeight() { + return minHeight; + } + + public void setMinHeight(double minHeight) { + this.minHeight = minHeight; + } + + public double getMaxHeight() { + return maxHeight; + } + + public void setMaxHeight(double maxHeight) { + this.maxHeight = maxHeight; + } + } + + public static class Terrain { + int maxHeight; + + int maxWidth; + + public Terrain() { + } + + public Terrain(int maxHeight, int maxWidth) { + this.maxHeight = maxHeight; + this.maxWidth = maxWidth; + } + + public int getMaxHeight() { + return maxHeight; + } + + public void setMaxHeight(int maxHeight) { + this.maxHeight = maxHeight; + } + + public int getMaxWidth() { + return maxWidth; + } + + public void setMaxWidth(int maxWidth) { + this.maxWidth = maxWidth; + } + } + + public static class Water { + int maxHeight; + + int maxWidth; + + List<Long> data; + + public Water() { + } + + public Water(int maxHeight, int maxWidth, List<Long> data) { + this.maxHeight = maxHeight; + this.maxWidth = maxWidth; + this.data = data; + } + + public int getMaxHeight() { + return maxHeight; + } + + public void setMaxHeight(int maxHeight) { + this.maxHeight = maxHeight; + } + + public int getMaxWidth() { + return maxWidth; + } + + public void setMaxWidth(int maxWidth) { + this.maxWidth = maxWidth; + } + + public List<Long> getData() { + return data; + } + + public void setData(List<Long> data) { + this.data = data; + } + } + + public LayerVo() { + } + + public String getVer() { + return ver; + } + + public void setVer(String ver) { + this.ver = ver; + } + + public Duration getDuration() { + return duration; + } + + public void setDuration(Duration duration) { + this.duration = duration; + } + + public Extension getExtension() { + return extension; + } + + public void setExtension(Extension extension) { + this.extension = extension; + } + + public Terrain getTerrain() { + return terrain; + } + + public void setTerrain(Terrain terrain) { + this.terrain = terrain; + } + + public Water getWater() { + return water; + } + + public void setWater(Water water) { + this.water = water; + } +} diff --git a/src/main/java/com/se/simu/helper/WebHelper.java b/src/main/java/com/se/simu/helper/WebHelper.java index 29e6212..ba734c7 100644 --- a/src/main/java/com/se/simu/helper/WebHelper.java +++ b/src/main/java/com/se/simu/helper/WebHelper.java @@ -276,6 +276,15 @@ /** * 杈撳嚭JSON鑷抽〉闈� */ + public static boolean writeJson2Page(HttpServletResponse res, HttpStatus status, Object obj) { + res.setStatus(status.value()); + + return writeStr2Page(res, JSON.toJSONString(obj)); + } + + /** + * 杈撳嚭JSON鑷抽〉闈� + */ public static boolean writeJson2Page(HttpServletResponse res, HttpStatus status, String str) { res.setStatus(status.value()); diff --git a/src/main/java/com/se/simu/service/WaterService.java b/src/main/java/com/se/simu/service/WaterService.java index 44f1e1a..50a81ce 100644 --- a/src/main/java/com/se/simu/service/WaterService.java +++ b/src/main/java/com/se/simu/service/WaterService.java @@ -1,8 +1,13 @@ package com.se.simu.service; +import com.se.simu.domain.LayerVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * 鍐呮稘鏈嶅姟绫� @@ -13,14 +18,25 @@ @Slf4j @Service public class WaterService { + @Value("${sys.ver}") + String ver; + @Value("${sys.path.gdal}") String gdalPath; @Value("${sys.path.data}") String dataPath; - public Object getLayer(String serviceName) { + public LayerVo getLayer(String serviceName) { + LayerVo layer = new LayerVo(); + layer.setVer(ver); + layer.setDuration(new LayerVo.Duration(1719812810225L, 1719812810225L)); + layer.setExtension(new LayerVo.Extension(2.11062743358, 0.53812160220, 2.11070827834, 0.53819799453, 1.151, 38.83)); + layer.setTerrain(new LayerVo.Terrain(10000, 10000)); - return null; + List<Long> data = new ArrayList<>(Arrays.asList(1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L)); + layer.setWater(new LayerVo.Water(10000, 10000, data)); + + return layer; } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3088199..2dfbdad 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,4 +1,6 @@ +# 绯荤粺閰嶇疆 sys: + ver: 0.1 path: # Gdal椹卞姩鐩綍 gdal: E:/terrait/TianJin/Zip/release-1928-x64-dev/release-1928-x64/bin diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 1a85cef..2dfbdad 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,26 +1,8 @@ -server: - tomcat: - uri-encoding: UTF-8 - max-connections: 5000 - max-http-form-post-size: 50MB - threads: - max: 2000 - port: 8079 - servlet: - context-path: /simuserver - -spring: - mvc: - pathmatch: - # 瑙e喅Knife4j杩愯鎶ラ敊 - matching-strategy: ant_path_matcher - application: - name: simuserver - -knife4j: - # 鏄惁寮�鍚� - enabled: true - # 璇锋眰鍓嶇紑 - pathMapping: - # 鏄惁寮�鍚寮烘ā寮� - enable: true +# 绯荤粺閰嶇疆 +sys: + ver: 0.1 + path: + # Gdal椹卞姩鐩綍 + gdal: E:/terrait/TianJin/Zip/release-1928-x64-dev/release-1928-x64/bin + # 鍒嗘瀽鏁版嵁鏁版嵁 + data: D:/simu/ -- Gitblit v1.9.3