| | |
| | | @ApiOperation(value = "04.testPngList <") |
| | | @GetMapping("/testPngList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\out\\chicago\\waters"), |
| | | @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\out\\fs24cubic"), |
| | | @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; |
| | | |
| | | String newPath = config.getOutPath() + File.separator + path + File.separator + "waters"; |
| | | String pngPath = config.getOutPath() + File.separator + path + File.separator + "png"; |
| | | if (!new File(pngPath).exists()) new File(pngPath).mkdirs(); |
| | | |
| | | int i = 1; |
| | | List<String> list = new ArrayList<>(); |
| | | for (File file : new File(path).listFiles()) { |
| | | for (File file : new File(newPath).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("\\", "/") + "'"); |
| | | String pngName = i + ".png"; // String.format("f%06d", i) |
| | | Files.copy(pngFile.toPath(), Paths.get(pngPath + File.separator + pngName), StandardCopyOption.REPLACE_EXISTING); |
| | | |
| | | list.add("file '" + pngName + "'"); |
| | | System.out.println(list.get(list.size() - 1)); |
| | | i++; |
| | | } |
| | | |
| | | Path outPath = Paths.get(path + File.separator + "list.txt"); |
| | | Path outPath = Paths.get(pngPath + File.separator + "list.txt"); |
| | | try { |
| | | Files.write(outPath, list, StandardCharsets.UTF_8); |
| | | } catch (IOException e) { |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "tifPath", value = "Tif路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\uwsolver\\chicago"), |
| | | @ApiImplicitParam(name = "inPath", value = "输入路径", dataType = "String", paramType = "query", example = "20250425"), |
| | | @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Integer", paramType = "query", example = "2025-04-25 00:00:00"), |
| | | @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "Integer", paramType = "query", example = "2025-04-29 00:00:00"), |
| | | @ApiImplicitParam(name = "epsg", value = "坐标系ID", dataType = "Integer", paramType = "query", example = "4548") |
| | | }) |
| | | public R<Object> testCreateNsl(String tifPath, String inPath, String startTime, Integer epsg) { |
| | |
| | | data.setStartTime(StringHelper.YMDHMS_FORMAT.parse(startTime)); |
| | | data.setEpsg(epsg); |
| | | |
| | | procTifs(tifPath, data.getStartTime()); |
| | | procTifs(tifPath, inPath, data.getStartTime()); |
| | | testService.test(data); |
| | | |
| | | return success("ok"); |
| | |
| | | } |
| | | } |
| | | |
| | | private void procTifs(String tifPath, Date startTime) { |
| | | private void procTifs(String tifPath, String inPath, Date startTime) { |
| | | if (StringUtils.isEmpty(tifPath)) return; |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date(startTime.getYear() - 1900, startTime.getMonth() - 1, startTime.getDay(), 0, 0, 0)); |
| | | //calendar.setTime(new Date(startTime.getYear() - 1900, startTime.getMonth() - 1, startTime.getDay(), 0, 0, 0)); |
| | | calendar.setTime(startTime); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String newPath = config.getInPath() + File.separator + "depth"; |
| | | String newPath = config.getInPath() + File.separator + inPath + File.separator + "depth"; |
| | | if (!new File(newPath).exists()) new File(newPath).mkdirs(); |
| | | |
| | | for (File file : new File(tifPath).listFiles()) { |
| | | if (!file.exists() || !file.isDirectory()) continue; |
| | |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "11.renametifs <") |
| | | @GetMapping("/renametifs") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "路径", dataType = "String", paramType = "query", example = "D:\\other\\simu\\uwsolver\\chicago\\depth"), |
| | | @ApiImplicitParam(name = "prefix", value = "前缀", dataType = "Integer", paramType = "query", example = "01250302"), |
| | | @ApiImplicitParam(name = "newPrefix", value = "新前缀", dataType = "Integer", paramType = "query", example = "20250429") |
| | | }) |
| | | public R<Object> renametifs(String path, String prefix, String newPrefix) { |
| | | try { |
| | | File[] files = new File(path).listFiles(); |
| | | for (File file : files) { |
| | | String newName = file.getPath().replace(prefix, newPrefix); |
| | | file.renameTo(new File(newName)); |
| | | } |
| | | |
| | | return success("ok"); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "10.当前时间 *") |
| | | @GetMapping("/getTime") |
| | | public Object getTime() { |