src/main/java/com/se/simu/controller/SimuController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/domain/dto/GridDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/utils/SemUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/grid.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/se/simu/controller/SimuController.java
@@ -7,6 +7,7 @@ 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.*; @@ -495,6 +496,7 @@ 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 { @@ -514,6 +516,34 @@ 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 { src/main/java/com/se/simu/domain/dto/GridDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,26 @@ package com.se.simu.domain.dto; import java.io.Serializable; public class GridDto implements Serializable { private Double lat; private Double lon; public Double getLat() { return lat; } public void setLat(Double lat) { this.lat = lat; } public Double getLon() { return lon; } public void setLon(Double lon) { this.lon = lon; } } src/main/java/com/se/simu/utils/SemUtils.java
@@ -5,18 +5,7 @@ public class SemUtils { public static void main(String[] args) throws Exception { //cityjson转sem ç®¡ç¹ å®æ // SEM sem = SEM.fromCityJSON("D:\\out\\point\\1737602481122\\管ç¹.json"); // sem.writeToFile("D:\\out\\point\\1737602481122\\point.sem"); //cityjson转sem 管线 // SEM sem = SEM.fromCityJSON("D:\\out\\line\\1737615372545\\管线.json"); // sem.writeToFile("D:\\out\\line\\1737615372545\\管线.sem"); //cityjson转sem å°å½¢ 宿 // SEM sem = SEM.fromCityJSON("D:\\out\\terrain\\1737603153671\\terrain.json"); // sem.writeToFile("D:\\out\\terrain\\1737603153671\\terrain.sem"); //cityjson转sem éé¨(æå) SEM sem = SEM.fromCityJSON("D:\\out\\station_rain_1736399134241\\éé¨é.json"); sem.writeToFile("D:\\out\\station_rain_1736399134241\\éé¨é.sem"); semToCityJson(); } public static void cityJsonToSem(String jsonUrl,String semUrl) throws Exception { //cityjson转sem @@ -25,7 +14,7 @@ } public static void semToCityJson() throws Exception { //sem转cityjson SEM sem2 = new SEM("C:\\XXX\\Grid.sem"); sem2.writeToCityJSON("C:\\XXX\\Gridout.json"); SEM sem2 = new SEM("D:\\åå¸å æ¶\\sem\\tongzhou\\tongzhou\\grid.sem"); sem2.writeToCityJSON("D:\\åå¸å æ¶\\sem\\tongzhou\\tongzhou\\grid\\grid.json"); } } src/main/resources/grid.json
¶Ô±ÈÐÂÎļþ @@ -0,0 +1 @@ {"type":"CityJSON","version":"1.0","metadata":{"datasetPointOfContact":{}},"Dynamizers":[{"gmlId":"UUID_f5a04e3c-ba56-44d0-922d-de80f208267a"}],"CityObjects":{"UUID_f5a04e3c-ba56-44d0-922d-de80f208267a":{"type":"+Grid","geometry":[{"type":"MultiSurface","boundaries":[[[0,1,2,3]]],"lod":0}]}},"vertices":[],"appearance":{"materials":[],"textures":[],"vertices-texture":[]},"geometry-templates":{"templates":[],"vertices-templates":[]}}