张洋洋
2025-01-23 6540880475e1c3b182422838496aff42c6c9b94f
src/main/java/com/se/simu/controller/SimuController.java
@@ -343,7 +343,7 @@
    @ApiOperation(value = "tarr文件组装")
    @GetMapping(value = "/saveZarr", produces = "application/json; charset=UTF-8")
    public R<Boolean> saveZarr(@RequestParam("name") String tableName) throws IOException {
    public R<String> saveZarr(@RequestParam("name") String tableName) throws Exception {
        List<String> list = CsvToSQLiteUtils.getNameList(tableName);
        String path = outPath + "\\";
        String rainfall = "rainfall\\";
@@ -400,7 +400,8 @@
        FileWriter fileWriter = new FileWriter(path + tableName + "\\降雨量.json");
        fileWriter.write(jsonObject.toJSONString());
        fileWriter.close();
        return success(true);
        SemUtils.cityJsonToSem(path + tableName + "\\降雨量.json",path + tableName + "\\降雨量.sem");
        return success(path + tableName + "\\降雨量.sem");
    }
    @ApiOperation(value = "管点转cityjson")
@@ -443,7 +444,8 @@
        FileWriter fileWriter = new FileWriter(pointPath);
        fileWriter.write(jsonObject.toJSONString());
        fileWriter.close();
        return success(pointPath);
        SemUtils.cityJsonToSem(pointPath,path + times + "\\管点.sem");
        return success(path + times + "\\管点.sem");
    }
    @ApiOperation(value = "管线转cityjson")
@@ -473,7 +475,9 @@
            JSONArray jsonArray=new JSONArray();
            jsonArray.add(boundarie);
            metry.put("boundaries", jsonArray);
            cityObject.put("geometry",metry);
            JSONArray metryArray=new JSONArray();
            metryArray.add(metry);
            cityObject.put("geometry",metryArray);
            cityObject.put("attributes",attribute);
            cityObject.put("attributes", attribute);
            geometry.add(metry);
@@ -488,9 +492,28 @@
        FileWriter fileWriter = new FileWriter(pointPath);
        fileWriter.write(jsonObject.toJSONString());
        fileWriter.close();
        return success(pointPath);
        SemUtils.cityJsonToSem(pointPath, path + times + "\\管线.sem");
        return success(path + times + "\\管线.sem");
    }
    @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.tifToPng(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();
        SemUtils.cityJsonToSem(path + "terrain.json", path + "terrain.sem");
        return success(path + "terrain.sem");
    }
    public JSONObject getModule(String moduleName) {
        JSONObject jsonObject = new JSONObject();
        try {