| | |
| | | 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")); |
| | |
| | | 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文件组装") |
| | |
| | | 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 { |
| | |
| | | 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 { |
| | |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | double minx=180.0; |
| | | double maxx=0.0; |
| | | double miny=180.0; |
| | | double maxy=0.0; |
| | | for (GridDto dto:dtos |
| | | ) { |
| | | if (dto.getLon()>maxx){ |
| | | maxx=dto.getLon(); |
| | | double minx = 180.0; |
| | | double maxx = 0.0; |
| | | double miny = 180.0; |
| | | double maxy = 0.0; |
| | | for (GridDto dto : dtos |
| | | ) { |
| | | if (dto.getLon() > maxx) { |
| | | maxx = dto.getLon(); |
| | | } |
| | | if (dto.getLon()<minx){ |
| | | minx=dto.getLon(); |
| | | if (dto.getLon() < minx) { |
| | | minx = dto.getLon(); |
| | | } |
| | | if (dto.getLat()>maxy){ |
| | | maxy=dto.getLat(); |
| | | if (dto.getLat() > maxy) { |
| | | maxy = dto.getLat(); |
| | | } |
| | | if (dto.getLat()<miny){ |
| | | miny=dto.getLat(); |
| | | if (dto.getLat() < miny) { |
| | | miny = dto.getLat(); |
| | | } |
| | | } |
| | | JSONArray min= ProjectionToGeographicUtil.get4548Point(minx,miny); |
| | | JSONArray max=ProjectionToGeographicUtil.get4548Point(maxx,maxy); |
| | | String tifPath=path+"terrain.tif"; |
| | | TiffClipper.cropTiffByLatLon(config.getTifPath(),tifPath,min.getDouble(0),min.getDouble(1),max.getDouble(0),max.getDouble(1)); |
| | | JSONArray min = ProjectionToGeographicUtil.get4548Point(minx, miny); |
| | | JSONArray max = ProjectionToGeographicUtil.get4548Point(maxx, maxy); |
| | | String tifPath = path + "terrain.tif"; |
| | | TiffClipper.cropTiffByLatLon(config.getTifPath(), tifPath, min.getDouble(0), min.getDouble(1), max.getDouble(0), max.getDouble(1)); |
| | | String pngPath = path + "appearance\\terrain.png"; |
| | | TiffToRGBUtil.tifToPng(tifPath, pngPath); |
| | | JSONObject jsonObject = getModule("terrainmodule.json"); |