| | |
| | | |
| | | @ApiOperation(value = "testResuslt *") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query", example = "20241010095328") |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query", example = "20241010095328"), |
| | | @ApiImplicitParam(name = "time", value = "æ¶é´", dataType = "String", paramType = "query", example = "2024-11-07 09:23:42") |
| | | }) |
| | | @GetMapping("/testResuslt") |
| | | public R<Object> testResuslt(String path) { |
| | | public R<Object> testResuslt(String path,String time) { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setEpsg(4548); |
| | | data.setInPath(path); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00")); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse(time)); |
| | | |
| | | resultService.process(data); |
| | | |
| | |
| | | |
| | | private double maxHeight; |
| | | |
| | | public ExtensionDto(){} |
| | | public ExtensionDto() { |
| | | } |
| | | |
| | | public ExtensionDto(double minx, double miny, double maxx, double maxy) { |
| | | this.minx = minx; |
| | |
| | | this.maxy = maxy; |
| | | this.minHeight = minHeight; |
| | | this.maxHeight = maxHeight; |
| | | } |
| | | |
| | | public void setHeight(double minHeight, double maxHeight) { |
| | | synchronized (this) { |
| | | if (this.minHeight > minHeight) { |
| | | this.minHeight = minHeight; |
| | | } |
| | | if (this.maxHeight < maxHeight) { |
| | | this.maxHeight = maxHeight; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public double getMinx() { |
| | |
| | | @JSONField(serialize = false) |
| | | private String epsg; |
| | | |
| | | @JSONField(serialize = false) |
| | | private Double minHeight; |
| | | |
| | | @JSONField(serialize = false) |
| | | private Double maxHeight; |
| | | |
| | | public TerrainDto() { |
| | | } |
| | | |
| | |
| | | for (Integer i : sizes) { |
| | | size.add(new int[]{i, i}); |
| | | } |
| | | } |
| | | |
| | | public void setHeight(Double minHeight, Double maxHeight) { |
| | | this.minHeight = minHeight; |
| | | this.maxHeight = maxHeight; |
| | | } |
| | | |
| | | public List<int[]> getSize() { |
| | |
| | | |
| | | public void setEpsg(String epsg) { |
| | | this.epsg = epsg; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | @JSONField(serialize = false) |
| | | private List<String> files; |
| | | |
| | | @JSONField(serialize = false) |
| | | private Double minHeight; |
| | | |
| | | @JSONField(serialize = false) |
| | | private Double maxHeight; |
| | | |
| | | private List<Long> data; |
| | | |
| | | public WaterDto() { |
| | | this.files = new ArrayList<>(); |
| | | this.data = new ArrayList<>(); |
| | | } |
| | | |
| | | public void setHeight(double minHeight, double maxHeight) { |
| | | synchronized (this) { |
| | | if (this.minHeight > minHeight) { |
| | | this.minHeight = minHeight; |
| | | } |
| | | if (this.maxHeight < maxHeight) { |
| | | this.maxHeight = maxHeight; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<String> getFiles() { |
| | |
| | | public void setData(List<Long> data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | double miny = getMinVal(minPoint.GetY(0), 10000000); |
| | | double maxx = getMaxVal(maxPoint.GetX(0) + MAX_X_OFFSET, 10000000); |
| | | double maxy = getMaxVal(maxPoint.GetY(0), 10000000); |
| | | layer.setExtension(new ExtensionDto(minx, miny, maxx, maxy, Double.MAX_VALUE, Double.MIN_VALUE)); |
| | | //layer.setExtension(new ExtensionDto(minx, miny, maxx, maxy, Double.MAX_VALUE, Double.MIN_VALUE)); |
| | | |
| | | Band band = ds.GetRasterBand(1); |
| | | double[] mm = new double[2]; |
| | | band.ComputeRasterMinMax(mm, 0); |
| | | layer.getTerrain().setHeight(getMinVal(mm[0], 1000), getMaxVal(mm[1], 1000)); |
| | | //layer.getTerrain().setHeight(getMinVal(mm[0], 1000), getMaxVal(mm[1], 1000)); |
| | | layer.setExtension(new ExtensionDto(minx, miny, maxx, maxy, getMinVal(mm[0] - 1, 1000), getMaxVal(mm[1] + 1, 1000))); |
| | | } |
| | | |
| | | private static double getMinVal(double val, double radix) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * ééæ · |
| | | * ééæ ·: https://blog.51cto.com/u_16099346/6691820 |
| | | */ |
| | | private static void Resample(Dataset ds, String dest, int width, int height, LayerDto layer) { |
| | | Vector<String> vector = new Vector<>(); |
| | |
| | | |
| | | double[] mm = new double[2]; |
| | | ds.GetRasterBand(1).ComputeRasterMinMax(mm, 0); |
| | | layer.getExtension().setHeight(mm[0], mm[1]); |
| | | //layer.getExtension().setHeight(mm[0], mm[1]); |
| | | layer.getWaters().setHeight(mm[0], mm[1]); |
| | | } finally { |
| | | if (null != ds) ds.delete(); |
| | | } |
| | | }); |
| | | layer.getExtension().setMinHeight(getMinVal(layer.getExtension().getMinHeight() - 1, 1000)); |
| | | layer.getExtension().setMaxHeight(getMaxVal(layer.getExtension().getMaxHeight() + 1, 1000)); |
| | | //layer.getExtension().setMinHeight(getMinVal(layer.getExtension().getMinHeight() - 1, 1000)); |
| | | //layer.getExtension().setMaxHeight(getMaxVal(layer.getExtension().getMaxHeight() + 1, 1000)); |
| | | layer.getWaters().setMinHeight(getMinVal(layer.getWaters().getMinHeight() - 1, 1000)); |
| | | layer.getWaters().setMaxHeight(getMaxVal(layer.getWaters().getMaxHeight() + 1, 1000)); |
| | | } |
| | | |
| | | private static void processWaters(ResultDto dto, List<String> files, LayerDto layer) { |
| | |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | |
| | | if (null != vo.getNum()) { |
| | | wrapper.eq("num", vo.getNum()); |
| | | } |
| | | if (!StringUtils.isEmpty(vo.getName())) { |
| | | if (!StringHelper.isEmpty(vo.getName())) { |
| | | wrapper.like("lower(name)", vo.getName().trim().toLowerCase()); |
| | | } |
| | | if (!CollUtil.isEmpty(vo.getStatus())) { |
| | |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.helper.StringHelper; |
| | | import com.se.simu.helper.WebHelper; |
| | | import com.sun.xml.internal.messaging.saaj.util.TeeInputStream; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.simu.Rainfall; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡å½ä»¤è¡,å¹¶çå¾
å½ä»¤æ§è¡å®æ¯ |
| | | * æ§è¡å½ä»¤è¡,å¹¶çå¾
å½ä»¤æ§è¡å®æ¯ |
| | | * |
| | | * https://www.cnblogs.com/stars-one/p/16482964.html |
| | | * @param cmd å½ä»¤,windowè®°å¾è¦ä½¿ç¨cmd /cå¼å¤´,å¦cmd /c ipconfig |
| | | * @throws IOException |
| | | * @throws InterruptedException |
| | |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.domain.po.SimuPo; |
| | | import com.se.simu.domain.vo.*; |
| | | import com.se.simu.domain.vo.Layer; |
| | | import com.se.simu.helper.GdalHelper; |
| | | import com.se.simu.helper.StringHelper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | */ |
| | | public String getFlowMap(String serviceName, Integer width, Integer height, Long timestamp) { |
| | | 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(config.getVer()); |
| | | 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.setWaters(new Water(data)); |
| | | |
| | | return layer; |
| | | } |
| | | |
| | | /** |