张洋洋
2025-01-16 94d808f30053f8d03185cca31df3c8673d815699
src/main/java/com/se/simu/controller/SimuController.java
@@ -490,7 +490,24 @@
        fileWriter.close();
        return success(pointPath);
    }
    @ApiOperation(value = "地形转cityjson")
    @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 {