| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | @ApiOperation(value = "当前时间 *") |
| | | @GetMapping("/getTime") |
| | | public Object getTime() { |
| | | return System.currentTimeMillis(); |
| | | return (Object) System.currentTimeMillis(); |
| | | } |
| | | |
| | | @ApiOperation(value = "testCallExe *") |
| | |
| | | public R<Object> testResuslt(String path, String time) { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setEpsg(4548); |
| | | data.setEpsg(Integer.valueOf(4548)); |
| | | data.setInPath(path); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse(time)); |
| | | |
| | |
| | | public R<Object> testSww2Tif() { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setEpsg(4548); |
| | | data.setEpsg(Integer.valueOf(4548)); |
| | | data.setInPath("20241010095328"); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00")); |
| | | |
| | |
| | | public R<Object> testRainfall() { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setEpsg(4548); |
| | | data.setTotal(60.0); |
| | | data.setDuration(60); |
| | | data.setEpsg(Integer.valueOf(4548)); |
| | | data.setTotal(Double.valueOf(60.0)); |
| | | data.setDuration(Integer.valueOf(60)); |
| | | data.setInPath("20241010095328"); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-07-01 00:00:00")); |
| | | |
| | |
| | | public R<Object> testH5() { |
| | | try { |
| | | DataPo data = new DataPo(); |
| | | data.setEpsg(4548); |
| | | data.setEpsg(Integer.valueOf(4548)); |
| | | data.setInPath("20241010095328"); |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse("2024-09-30 00:00:00")); |
| | | |
| | |
| | | continue; // g.GetGeometryType() == ogr.wkbPolygon || g.GetGeometryType() == ogr.wkbMultiPolygon |
| | | |
| | | if (!wkt.contains("MULTIPOLYGON")) wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; |
| | | list.add(new Region(f.GetFieldAsString("name"), type.shortValue(), wkt)); |
| | | if (path.contains("孙胡沟")) list.add(new Region(f.GetFieldAsString("name"), (short) 3, wkt)); |
| | | list.add(new Region(f.GetFieldAsString("name"), type, wkt)); // type.shortValue() |
| | | if (path.contains("孙胡沟")) list.add(new Region(f.GetFieldAsString("name"), 3, wkt)); |
| | | } |
| | | } |
| | | ds.delete(); |
| | |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "testPngList <") |
| | | @GetMapping("/testPngList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\out\\chicago\\waters"), |
| | | @ApiImplicitParam(name = "size", value = "尺寸", dataType = "Integer", paramType = "query", example = "1024") |
| | | }) |
| | | public R<Object> testPngList(String path, Integer size) { |
| | | try { |
| | | if (null == size) size = (Integer) 1024; |
| | | List<String> list = new ArrayList<>(); |
| | | for (File file : new File(path).listFiles()) { |
| | | if (!file.exists() || file.isFile()) continue; |
| | | |
| | | File pngFile = new File(file.getPath() + File.separator + size + "_" + size + ".png"); |
| | | if (!pngFile.exists() || pngFile.isDirectory()) continue; |
| | | |
| | | list.add("file '" + pngFile.getPath().replace("\\", "/") + "'"); |
| | | System.out.println(list.get(list.size() - 1)); |
| | | } |
| | | |
| | | Path outPath = Paths.get(path + File.separator + "list.txt"); |
| | | try { |
| | | Files.write(outPath, list, StandardCharsets.UTF_8); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return success("ok"); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | } |