张洋洋
2025-02-14 a50e2b2d6f92040abfc98a027a966990fc27a278
[add]tif裁剪
已修改2个文件
38 ■■■■ 文件已修改
src/main/java/com/se/simu/controller/SimuController.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/GridDto.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/controller/SimuController.java
@@ -244,10 +244,6 @@
                        Double minY = jsonObject.getDouble("minX");
                        Double maxY = jsonObject.getDouble("maxX");
                        // 3 判断范围值是否为空
                        // vo.setMinx(jsonObject.getDouble("minX"));
                        // vo.setMaxx(jsonObject.getDouble("maxX"));
                        // vo.setMiny(jsonObject.getDouble("minY"));
                        // vo.setMaxy(jsonObject.getDouble("maxY"));
                        vo.setMinx(jsonObject.getDouble("minY"));
                        vo.setMaxx(jsonObject.getDouble("maxY"));
                        vo.setMiny(jsonObject.getDouble("minX"));
@@ -340,12 +336,36 @@
                    return fail("防汛范围不能为空", false);
                }
            }
            List<GridDto> dtos = new ArrayList<>();
            dtos.add(new GridDto(vo.getMinx(), vo.getMiny()));
            dtos.add(new GridDto(vo.getMinx(), vo.getMaxy()));
            dtos.add(new GridDto(vo.getMaxx(), vo.getMaxy()));
            dtos.add(new GridDto(vo.getMaxx(), vo.getMiny()));
            createSem(tableName, dtos);
            // 开始模拟计算
            boolean flag = simuFilesService.createByfiles(vo);
            return success(flag, flag ? "成功" : "失败");
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
    public R<Boolean> createSem(String tableName, List<GridDto> dtos) throws Exception {
        //降雨文件生成
        saveZarr(tableName);
        //管点生成
        pointTosem(dtos);
        //管线生成
        lineToSem(dtos);
        //地形生成
        terrainToSem(dtos);
        //范围生成
        gridToCityJson(dtos);
        //河流生成
        riverToSem();
        //土地利用生成
        landuseToSem();
        return success(true);
    }
    @ApiOperation(value = "tarr文件组装")
@@ -492,6 +512,7 @@
        SemUtils.cityJsonToSem(pointPath, filePatn + "node.sem");
        return success(filePatn + "node.sem");
    }
    @ApiOperation(value = "管点转cityjson")
    @GetMapping(value = "/pointToCityJson", produces = "application/json; charset=UTF-8")
    public R<String> pointToCityJson(@RequestParam("shpPath") String shpPath) throws Exception {
@@ -696,6 +717,7 @@
        SemUtils.cityJsonToSem(pointPath, filePatn + "link.sem");
        return success(filePatn + "link.sem");
    }
    @ApiOperation(value = "地形转sem")
    @PostMapping(value = "/terrainToSem", produces = "application/json; charset=UTF-8")
    public R<String> terrainToSem(@RequestBody List<GridDto> dtos) throws Exception {
src/main/java/com/se/simu/domain/dto/GridDto.java
@@ -7,6 +7,14 @@
    private Double lat;
    private Double lon;
    public GridDto(){
    }
    public GridDto(Double lat,Double lon){
        this.lat=lat;
        this.lon=lon;
    }
    public Double getLat() {
        return lat;