| | |
| | | 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; |
| | |
| | | |
| | | @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(); |
| | |
| | | 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; |
| | | } |
| | | } |