| | |
| | | import com.se.simu.domain.dto.LayerDto; |
| | | import com.se.simu.domain.dto.ResultDto; |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.domain.vo.BuildingDepthVo; |
| | | import com.se.simu.helper.GdalHelper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.gdal.gdal.Band; |
| | |
| | | PropertiesConfig config; |
| | | |
| | | public final static double MAX_X_OFFSET = 0; |
| | | |
| | | private final static SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | public void process(DataPo data) throws Exception { |
| | | String basePath = config.getInPath() + File.separator + data.getInPath() + File.separator; |
| | |
| | | layer.getTerrain().setEpsg(null); |
| | | |
| | | String json = JSON.toJSONString(layer); |
| | | //String json = JSONUtil.toJsonPrettyStr(layer); |
| | | // String json = JSONUtil.toJsonPrettyStr(layer); |
| | | String filePath = dto.getOutPath() + File.separator + "layer.json"; |
| | | |
| | | FileWriter fw = new FileWriter(filePath); |
| | | BufferedWriter bw = new BufferedWriter(fw); |
| | | bw.write(json); |
| | | bw.close(); |
| | | fw.close(); |
| | | writeJson(filePath, json); |
| | | } |
| | | |
| | | /** |
| | |
| | | String rainGageFilePath = config.getInPath() + File.separator + dto.getServiceName() + File.separator + "RainGage.dat"; |
| | | String filePath = dto.getOutPath() + File.separator + "rainfall.json"; |
| | | |
| | | String line; |
| | | Map<String, Double> rainFallJsons = new LinkedHashMap<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | Map<String, Double> map = new LinkedHashMap<>(); |
| | | FileReader fr = new FileReader(rainGageFilePath); |
| | | BufferedReader br = new BufferedReader(fr); |
| | | |
| | | BufferedReader br = new BufferedReader(new FileReader(rainGageFilePath)); |
| | | // 处理第一行数据 |
| | | if ((line = br.readLine()) != null) { |
| | | while ((line = br.readLine()) != null) { |
| | | // 处理每一行数据 |
| | | String[] rainFall = line.split(" "); |
| | | String line = br.readLine(); |
| | | while ((line = br.readLine()) != null) { |
| | | String[] rainFall = line.split(" "); |
| | | if (rainFall.length < 7) continue; |
| | | |
| | | if (rainFall.length < 7) continue; |
| | | |
| | | String sdt = rainFall[1] + "-" + rainFall[2] + "-" + rainFall[3] + " " + rainFall[4] + ":" + rainFall[5]; |
| | | BigDecimal num = new BigDecimal(rainFall[6]); |
| | | rainFallJsons.put("" + sdf.parse(sdt).getTime(), num.setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | String sdt = rainFall[1] + "-" + rainFall[2] + "-" + rainFall[3] + " " + rainFall[4] + ":" + rainFall[5]; |
| | | BigDecimal num = new BigDecimal(rainFall[6]); |
| | | map.put("" + SDF.parse(sdt).getTime(), num.setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | br.close(); |
| | | fr.close(); |
| | | |
| | | String json = JSON.toJSONString(map); |
| | | writeJson(filePath, json); |
| | | } |
| | | |
| | | private void copeBuildingDepthJson(ResultDto dto, List<BuildingDepthVo> list) throws IOException { |
| | | String json = JSON.toJSONString(list); |
| | | String filePath = dto.getOutPath() + File.separator + "building.json"; |
| | | |
| | | writeJson(filePath, json); |
| | | } |
| | | |
| | | private void writeJson(String filePath, String json) throws IOException { |
| | | FileWriter fw = new FileWriter(filePath); |
| | | BufferedWriter bw = new BufferedWriter(fw); |
| | | bw.write(JSON.toJSONString(rainFallJsons)); |
| | | bw.write(json); |
| | | bw.close(); |
| | | fw.close(); |
| | | } |