| | |
| | | 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 { |
| | | // String path = outPath + "\\point\\"; |
| | | // List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | // JSONObject jsonObject = getModule("pointmodule.json"); |
| | | // for (Map<String, Object> map : list |
| | | // ) { |
| | | // //拼装坐标 |
| | | // JSONArray vertice = new JSONArray(); |
| | | // vertice.add(map.get("lon")); |
| | | // vertice.add(map.get("lat")); |
| | | // vertice.add(0.0); |
| | | // jsonObject.getJSONArray("vertices").add(vertice); |
| | | // //拼装基础信息 |
| | | // JSONObject cityObject = new JSONObject(); |
| | | // cityObject.put("type", "+PipePoint"); |
| | | // JSONObject attribute = new JSONObject(); |
| | | // attribute.put("name", map.get("fsw")); |
| | | // cityObject.put("attributes", attribute); |
| | | // JSONArray geometry = new JSONArray(); |
| | | // JSONObject metry = new JSONObject(); |
| | | // metry.put("type", "MultiPoint"); |
| | | // metry.put("lod", 0); |
| | | // JSONArray boundarie = new JSONArray(); |
| | | // boundarie.add(jsonObject.getJSONArray("vertices").size() - 1); |
| | | // metry.put("boundaries", boundarie); |
| | | // geometry.add(metry); |
| | | // cityObject.put("geometry", geometry); |
| | | // jsonObject.getJSONObject("CityObjects").put("UUID_" + UUID.randomUUID().toString(), cityObject); |
| | | // } |
| | | // long times = System.currentTimeMillis(); |
| | | // String pointPath = path + times + "\\管点.json"; |
| | | // File dirFile = new File(path + times); |
| | | // if (!dirFile.exists()) { |
| | | // dirFile.mkdirs(); |
| | | // } |
| | | // FileWriter fileWriter = new FileWriter(pointPath); |
| | | // fileWriter.write(jsonObject.toJSONString()); |
| | | // fileWriter.close(); |
| | | // String filePatn = inPath + "\\tongzhou\\"; |
| | | // File file = new File(filePatn); |
| | | // if (!file.exists()) { |
| | | // file.mkdirs(); |
| | | // } |
| | | // 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 { |
| | | String path = outPath + "\\point\\"; |
| | | List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | JSONObject jsonObject = getModule("pointmodule.json"); |
| | | for (Map<String, Object> map : list |
| | | ) { |
| | | //拼装坐标 |
| | | JSONArray vertice = new JSONArray(); |
| | | vertice.add(map.get("lon")); |
| | | vertice.add(map.get("lat")); |
| | | vertice.add(0.0); |
| | | jsonObject.getJSONArray("vertices").add(vertice); |
| | | //拼装基础信息 |
| | | JSONObject cityObject = new JSONObject(); |
| | | cityObject.put("type", "+PipePoint"); |
| | | JSONObject attribute = new JSONObject(); |
| | | attribute.put("name", map.get("fsw")); |
| | | cityObject.put("attributes", attribute); |
| | | JSONArray geometry = new JSONArray(); |
| | | JSONObject metry = new JSONObject(); |
| | | metry.put("type", "MultiPoint"); |
| | | metry.put("lod", 0); |
| | | JSONArray boundarie = new JSONArray(); |
| | | boundarie.add(jsonObject.getJSONArray("vertices").size() - 1); |
| | | metry.put("boundaries", boundarie); |
| | | geometry.add(metry); |
| | | cityObject.put("geometry", geometry); |
| | | jsonObject.getJSONObject("CityObjects").put("UUID_" + UUID.randomUUID().toString(), cityObject); |
| | | } |
| | | long times = System.currentTimeMillis(); |
| | | String pointPath = path + times + "\\管点.json"; |
| | | File dirFile = new File(path + times); |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(pointPath); |
| | | fileWriter.write(jsonObject.toJSONString()); |
| | | fileWriter.close(); |
| | | String filePatn = inPath + "\\tongzhou\\"; |
| | | File file = new File(filePatn); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | SemUtils.cityJsonToSem(pointPath, filePatn + "node.sem"); |
| | | return success(filePatn + "node.sem"); |
| | | } |
| | | |
| | | @ApiOperation(value = "管线sem生成") |
| | | @PostMapping(value = "/lineToSem", produces = "application/json; charset=UTF-8") |