| | |
| | | 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; |
| | |
| | | @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()) { |
| | |
| | | * 获取地形高度图 |
| | | */ |
| | | 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"; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | 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)); |
| | | |