| | |
| | | package com.se.simu.controller; |
| | | |
| | | import com.se.simu.domain.LayerVo; |
| | | import com.se.simu.domain.Layer; |
| | | import com.se.simu.helper.WebHelper; |
| | | import com.se.simu.service.WaterService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | return; |
| | | } |
| | | |
| | | LayerVo layer = waterService.getLayer(serviceName); |
| | | Layer layer = waterService.getLayer(serviceName); |
| | | |
| | | WebHelper.writeJson2Page(res, HttpStatus.OK, layer); |
| | | } catch (Exception ex) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.simu.domain; |
| | | |
| | | /** |
| | | * æç»æ¶é´å®ä½ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-18 |
| | | */ |
| | | public 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.simu.domain; |
| | | |
| | | /** |
| | | * æç»æ¶é´å®ä½ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-18 |
| | | */ |
| | | public 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.simu.domain; |
| | | |
| | | /** |
| | | * å¾å±å®ä½ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-16 |
| | | */ |
| | | public class Layer { |
| | | String version; |
| | | |
| | | Duration duration; |
| | | |
| | | Extension extension; |
| | | |
| | | Terrain terrain; |
| | | |
| | | Water waters; |
| | | |
| | | public Layer() { |
| | | } |
| | | |
| | | public Layer(String version, Duration duration, Extension extension, Terrain terrain, Water waters) { |
| | | this.version = version; |
| | | this.duration = duration; |
| | | this.extension = extension; |
| | | this.terrain = terrain; |
| | | this.waters = waters; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | 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 getWaters() { |
| | | return waters; |
| | | } |
| | | |
| | | public void setWaters(Water waters) { |
| | | this.waters = waters; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.simu.domain; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å°å½¢å®ä½ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-18 |
| | | */ |
| | | public class Terrain { |
| | | /** |
| | | * 尺寸ï¼64*64 ... 2048*2048 |
| | | */ |
| | | List<Integer[]> size; |
| | | |
| | | public Terrain() { |
| | | } |
| | | |
| | | public Terrain(List<Integer[]> size) { |
| | | this.size = size; |
| | | } |
| | | |
| | | public List<Integer[]> getSize() { |
| | | return size; |
| | | } |
| | | |
| | | public void setSize(List<Integer[]> size) { |
| | | this.size = size; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.simu.domain; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ°´é¢å®ä½ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-07-18 |
| | | */ |
| | | public class Water { |
| | | List<Long> data; |
| | | |
| | | public Water() { |
| | | } |
| | | |
| | | public Water(List<Long> data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public List<Long> getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(List<Long> data) { |
| | | this.data = data; |
| | | } |
| | | } |
| | |
| | | package com.se.simu.service; |
| | | |
| | | import com.se.simu.domain.LayerVo; |
| | | import com.se.simu.domain.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Value("${sys.path.data}") |
| | | String dataPath; |
| | | |
| | | 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)); |
| | | public Layer getLayer(String serviceName) { |
| | | Layer layer = new Layer(); |
| | | layer.setVersion(ver); |
| | | layer.setDuration(new Duration(1719812810225L, 1719812810225L)); |
| | | layer.setExtension(new Extension(2.11062743358, 0.53812160220, 2.11070827834, 0.53819799453, 1.151, 38.83)); |
| | | |
| | | List<Integer[]> sizes = new ArrayList<>(); |
| | | sizes.add(new Integer[]{64, 64}); |
| | | sizes.add(new Integer[]{128, 128}); |
| | | sizes.add(new Integer[]{256, 256}); |
| | | sizes.add(new Integer[]{512, 512}); |
| | | sizes.add(new Integer[]{1024, 1024}); |
| | | sizes.add(new Integer[]{2048, 2048}); |
| | | layer.setTerrain(new Terrain(sizes)); |
| | | |
| | | List<Long> data = new ArrayList<>(Arrays.asList(1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L, 1719812812225L)); |
| | | layer.setWater(new LayerVo.Water(10000, 10000, data)); |
| | | layer.setWaters(new Water(data)); |
| | | |
| | | return layer; |
| | | } |