| | |
| | | import java.util.List; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | /** |
| | | * 处理结果服务类 |
| | | * |
| | | * @author WWW |
| | | * @date 2024-09-29 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 地形 |
| | | */ |
| | | private void copeTerrain(ResultDto dto, LayerDto layer) { |
| | | Dataset ds = null; |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重采样: https://blog.51cto.com/u_16099346/6691820 |
| | | */ |
| | | private static void Resample(Dataset ds, String dest, int width, int height, LayerDto layer) { |
| | | Vector<String> vector = new Vector<>(); |
| | | //vector.add("-s_srs"); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 建筑 |
| | | */ |
| | | private void copeBuilding(ResultDto dto, LayerDto layer) { |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 水面 |
| | | */ |
| | | private void setWaterInfo(ResultDto dto, LayerDto layer) { |
| | | List<String> files = getFiles(dto.getWaterPath(), ".tif"); |
| | | layer.getWaters().setFiles(files); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否相交 |
| | | * https://blog.csdn.net/flyingshineangel/article/details/135423025 |
| | | */ |
| | | private static BuildingDto intersects(ResultDto dto, double x, double y) { |
| | | Geometry p = new Geometry(ogr.wkbPoint); |
| | | p.AddPoint_2D(x, y); |
| | |
| | | |
| | | private static void createFlowPng(float[] vxBuffer, float[] vyBuffer, String png, int width, int height) { |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | // 用 R通道表示,流向为归一化的二维向量(x,y),G通道表示为 x *255 , B通道表示为 y * 255 |
| | | for (int x = 0; x < width; x++) { |
| | | for (int y = 0; y < height; y++) { |
| | | int offset = x + y * width; |
| | |
| | | return val; |
| | | } |
| | | |
| | | /** |
| | | * 元数据 |
| | | */ |
| | | private void copeLayerJson(ResultDto dto, LayerDto layer) throws IOException { |
| | | layer.getWaters().setFiles(null); |
| | | layer.getTerrain().setEpsg(null); |
| | |
| | | writeJson(filePath, json); |
| | | } |
| | | |
| | | /** |
| | | * 处理降水曲线文件曲线图 |
| | | */ |
| | | public void copeRainFallJson(ResultDto dto, LayerDto layer) throws IOException, ParseException { |
| | | String rainGageFilePath = config.getInPath() + File.separator + dto.getServiceName() + File.separator + "RainGage.dat"; |
| | | String filePath = dto.getOutPath() + File.separator + "rainfall.json"; |