From 94d808f30053f8d03185cca31df3c8673d815699 Mon Sep 17 00:00:00 2001 From: 张洋洋 <10611411+yang-yang-z@user.noreply.gitee.com> Date: 星期四, 16 一月 2025 13:09:49 +0800 Subject: [PATCH] [add]管线json --- src/main/java/com/se/simu/controller/SimuController.java | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/se/simu/controller/SimuController.java b/src/main/java/com/se/simu/controller/SimuController.java index f9bc490..d4cae22 100644 --- a/src/main/java/com/se/simu/controller/SimuController.java +++ b/src/main/java/com/se/simu/controller/SimuController.java @@ -490,7 +490,24 @@ fileWriter.close(); return success(pointPath); } - + @ApiOperation(value = "鍦板舰杞琧ityjson") + @GetMapping(value = "/terrainToCityJson", produces = "application/json; charset=UTF-8") + public R<String> terrainToCityJson(@RequestParam("tifPath") String tifPath) throws Exception { + long times = System.currentTimeMillis(); + String path = outPath + "\\terrain\\"+times+"\\"; + File dirFile = new File(path+"appearance"); + if (!dirFile.exists()) { + dirFile.mkdirs(); + } + String pngPath=path+"appearance\\terrain.png"; + TiffToRGBUtil.tiffToPng(tifPath,pngPath); + JSONObject jsonObject = getModule("terrainmodule.json"); + jsonObject.put("vertices",TiffCoordinateExtractorUtil.getCoordinate(tifPath)); + FileWriter fileWriter = new FileWriter(path + "terrain.json"); + fileWriter.write(jsonObject.toJSONString()); + fileWriter.close(); + return success(path); + } public JSONObject getModule(String moduleName) { JSONObject jsonObject = new JSONObject(); try { -- Gitblit v1.9.3