| | |
| | | package com.moon.server.service.data; |
| | | |
| | | import com.moon.server.entity.all.StaticData; |
| | | import com.moon.server.entity.ctrl.CountEntity; |
| | | import com.moon.server.entity.data.PointEntity; |
| | | import com.moon.server.helper.*; |
| | | import org.apache.commons.logging.Log; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 栅格分析服务 |
| | | * @author WWW |
| | | * @date 2023-11-16 |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class SlopeAnalysisService { |
| | | @Value("${sys.path.slopFile}") |
| | | private String filePath; |
| | |
| | | |
| | | private final static Log log = LogFactory.getLog(SlopeAnalysisService.class); |
| | | |
| | | /** |
| | | * 获取Excel模板 |
| | | */ |
| | | private String getXlsTemplate() { |
| | | private String getXlsTemplate() throws IOException { |
| | | if (null == xlsTemplate) { |
| | | xlsTemplate = FileHelper.getClassPath() + "config/slope.xlsx"; |
| | | xlsTemplate = FileHelper.getClassPathForWar() + File.separator + "config" + File.separator + "slope.xlsx"; |
| | | } |
| | | |
| | | return xlsTemplate; |
| | | } |
| | | |
| | | /** |
| | | * 下载坡度分析Excel |
| | | */ |
| | | public void downloadSlopXls(Geometry polygon, HttpServletResponse res) throws Exception { |
| | | Dataset ds = null; |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分析多边形 |
| | | */ |
| | | public List<PointEntity> analysisPolygon(Geometry geo, Dataset ds) { |
| | | double[] transform = ds.GetGeoTransform(); |
| | | int xSize = ds.getRasterXSize(), ySize = ds.getRasterYSize(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 创建Excel |
| | | */ |
| | | public String createXls(List<PointEntity> list, String template) { |
| | | String target = pathHelper.getTempPath() + File.separator + "slope_" + StringHelper.YMD2_FORMAT.format(new Date()) + ".xlsx"; |
| | | |