| | |
| | | package com.se.simu.domain.dto; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.se.simu.helper.GdalHelper; |
| | | import org.gdal.osr.SpatialReference; |
| | | |
| | | import java.io.File; |
| | | import java.util.*; |
| | |
| | | |
| | | private String temp; |
| | | |
| | | private int epsg; |
| | | |
| | | private SpatialReference spatialReference; |
| | | |
| | | private Map<String, float[]> buildings; |
| | | |
| | | private List<BuildingDto> buildingList; |
| | |
| | | this.buildingList = new ArrayList<>(); |
| | | } |
| | | |
| | | public ResultDto(String serviceName, String terrainFile, String buildingFile, String waterPath, String flowPath, String outPath) { |
| | | public ResultDto(String serviceName, String terrainFile, String buildingFile, String waterPath, String flowPath, String outPath, int epsg) { |
| | | this(); |
| | | this.serviceName = serviceName; |
| | | this.terrainFile = terrainFile; |
| | |
| | | this.flowPath = flowPath; |
| | | this.outPath = outPath + File.separator + serviceName; |
| | | this.temp = outPath + File.separator + serviceName + File.separator + "temp"; |
| | | this.epsg = epsg; |
| | | this.spatialReference = GdalHelper.createSpatialReference(epsg); |
| | | |
| | | File dir = new File(this.outPath); |
| | | if (dir.exists() && dir.isDirectory()) { |
| | |
| | | public void setBuildingList(List<BuildingDto> buildingList) { |
| | | this.buildingList = buildingList; |
| | | } |
| | | |
| | | public int getEpsg() { |
| | | return epsg; |
| | | } |
| | | |
| | | public void setEpsg(int epsg) { |
| | | this.epsg = epsg; |
| | | } |
| | | |
| | | public SpatialReference getSpatialReference() { |
| | | return spatialReference; |
| | | } |
| | | |
| | | public void setSpatialReference(SpatialReference spatialReference) { |
| | | this.spatialReference = spatialReference; |
| | | } |
| | | } |
| | |
| | | basePath + config.getBuildingFile(), |
| | | basePath + config.getWaterPath(), |
| | | basePath + config.getFlowPath(), |
| | | config.getOutPath()); |
| | | config.getOutPath(), |
| | | data.getEpsg()); |
| | | LayerDto layer = new LayerDto(config.getVer(), data.getEpsg(), config.getSizes()); |
| | | process(dto, layer); |
| | | } |
| | |
| | | try { |
| | | ds = gdal.Open(files.get(i), gdalconst.GA_ReadOnly); |
| | | if (null == ds || 0 == ds.getRasterCount()) return; |
| | | if (null == ds.GetSpatialRef()) ds.SetSpatialRef(dto.getSpatialReference()); |
| | | |
| | | createWaterPng(dto, ds, layer, layer.getWaters().getData().get(i)); |
| | | copyWaterTif(dto, ds, layer.getWaters().getData().get(i)); |
| | |
| | | try { |
| | | ds = gdal.Open(files.get(i), gdalconst.GA_ReadOnly); |
| | | if (null == ds || 0 == ds.getRasterCount()) return; |
| | | if (null == ds.GetSpatialRef()) ds.SetSpatialRef(dto.getSpatialReference()); |
| | | |
| | | createFlowPng(dto, ds, layer, layer.getWaters().getData().get(i)); |
| | | } finally { |