| | |
| | | import com.se.simu.config.PropertiesConfig; |
| | | import com.se.simu.domain.dto.GeDb; |
| | | import com.se.simu.domain.dto.GeLayer; |
| | | import com.se.simu.domain.dto.GridDto; |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.domain.po.SimuPo; |
| | | import com.se.simu.domain.vo.*; |
| | |
| | | SemUtils.cityJsonToSem(pointPath, path + times + "\\line.sem"); |
| | | return success(path + times + "\\line.sem"); |
| | | } |
| | | |
| | | @ApiOperation(value = "地形转cityjson") |
| | | @GetMapping(value = "/terrainToCityJson", produces = "application/json; charset=UTF-8") |
| | | public R<String> terrainToCityJson(@RequestParam("tifPath") String tifPath) throws Exception { |
| | |
| | | SemUtils.cityJsonToSem(path + "terrain.json", path + "terrain.sem"); |
| | | return success(path + "terrain.sem"); |
| | | } |
| | | |
| | | @ApiOperation(value = "grid转cityjson") |
| | | @PostMapping(value = "/gridToCityJson", produces = "application/json; charset=UTF-8") |
| | | public R<String> gridToCityJson(@RequestBody List<GridDto> dtos) throws Exception { |
| | | long times = System.currentTimeMillis(); |
| | | String path = outPath + "\\grid\\" + times + "\\"; |
| | | File dirFile = new File(path ); |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | JSONObject jsonObject = getModule("grid.json"); |
| | | JSONArray array = jsonObject.getJSONArray("vertices"); |
| | | for (GridDto dto:dtos |
| | | ) { |
| | | JSONArray jsonArray=new JSONArray(); |
| | | jsonArray.add(dto.getLon()); |
| | | jsonArray.add(dto.getLat()); |
| | | jsonArray.add(0); |
| | | array.add(jsonArray); |
| | | } |
| | | jsonObject.put("vertices",array); |
| | | FileWriter fileWriter = new FileWriter(path + "grid.json"); |
| | | fileWriter.write(jsonObject.toJSONString()); |
| | | fileWriter.close(); |
| | | SemUtils.cityJsonToSem(path + "grid.json", path + "grid.sem"); |
| | | return success(path + "grid.sem"); |
| | | } |
| | | |
| | | public JSONObject getModule(String moduleName) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |