| | |
| | | @Resource |
| | | RasterAnalysisService rasterService; |
| | | |
| | | private final static List<Integer> pixels = new ArrayList<>(Arrays.asList(1, 2, 4, 8, 16, 32, 64, 128, 256)); |
| | | private final static List<Integer> PIXELS = new ArrayList<>(Arrays.asList(1, 2, 4, 8, 16, 32, 64, 128, 256)); |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询点分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "点WKT", dataType = "String", example = "POINT (115.94927385452 32.3754479115071)"), |
| | | @ApiImplicitParam(name = "wkt", value = "点WKT", dataType = "String", example = "POINT (157.750107 29.036669)"), |
| | | @ApiImplicitParam(name = "pixel", value = "像素值", dataType = "Integer", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPoint") |
| | | public ResponseMsg<Object> selectByPoint(String wkt, Integer pixel) { |
| | | try { |
| | | // Map<String, Double> map = new HashMap<>(5); map.put("图层名", 0.0); return success(map) |
| | | if (StringHelper.isEmpty(wkt)) { |
| | | return fail("WKT字符串不能为空"); |
| | | } |
| | |
| | | if (null == geo || geo.GetGeometryType() != ogr.wkbPoint) { |
| | | return fail("WKT字符串不正确"); |
| | | } |
| | | if (null == pixel || !pixels.contains(pixel)) { |
| | | return fail("像点值只能为:" + StringHelper.join(pixels, ", ")); |
| | | if (null == pixel || !PIXELS.contains(pixel)) { |
| | | return fail("像点值只能为:" + StringHelper.join(PIXELS, ", ")); |
| | | } |
| | | |
| | | List<?> rs = rasterService.analysisPoint(wkt, pixel); |
| | | List<?> rs = rasterService.analysis(geo, pixel); |
| | | |
| | | return success(rs.size(), rs); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询线分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "线WKT", dataType = "String", example = "LINESTRING(115.94927385452 32.3754479115071,121.989371092554 32.2766788010181,121.850621222894 29.6874200067864)") |
| | | @ApiImplicitParam(name = "wkt", value = "线WKT", dataType = "String", example = "LINESTRING(165.680851 31.333443,166.383982 31.283475,166.016355 30.908709)") |
| | | }) |
| | | @GetMapping(value = "/selectByPolyline") |
| | | public ResponseMsg<Object> selectByPolyline(String wkt) { |
| | |
| | | return fail("WKT字符串不正确"); |
| | | } |
| | | |
| | | List<?> rs = rasterService.analysisPolyline(wkt); |
| | | List<?> rs = rasterService.analysis(geo, 0); |
| | | |
| | | return success(rs.size(), rs); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询面分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "面WKT", dataType = "String", example = "POLYGON ((115.94927385452 32.3754479115071,121.989371092554 32.2766788010181,121.850621222894 29.6874200067864,115.9727267226 29.7835368627922,115.94927385452 32.3754479115071))") |
| | | @ApiImplicitParam(name = "wkt", value = "面WKT", dataType = "String", example = "POLYGON ((165.680851 31.333443,166.383982 31.283475,166.016355 30.908709,165.680851 31.333443))") |
| | | }) |
| | | @GetMapping(value = "/selectByPolygon") |
| | | public ResponseMsg<Object> selectByPolygon(String wkt) { |
| | |
| | | return fail("WKT字符串不正确"); |
| | | } |
| | | |
| | | List<?> rs = rasterService.analysisPolygon(wkt); |
| | | List<?> rs = rasterService.analysis(geo, 0); |
| | | |
| | | return success(rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载点分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "点WKT", dataType = "String", example = "") |
| | | }) |
| | | @GetMapping(value = "/downloadByPoint") |
| | | public void downloadByPoint(String wkt, HttpServletResponse res) { |
| | | try { |
| | | // ... |
| | | |
| | | String filePath = "生成文件的路径"; |
| | | WebHelper.download(filePath, "文件名", res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载线分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "线WKT", dataType = "String", example = "") |
| | | }) |
| | | @GetMapping(value = "/downloadByPolyline") |
| | | public void downloadByPolyline(String wkt, HttpServletResponse res) { |
| | | try { |
| | | // ... |
| | | |
| | | String filePath = "生成文件的路径"; |
| | | WebHelper.download(filePath, "文件名", res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载面分析") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "面WKT", dataType = "String", example = "") |
| | | }) |
| | | @GetMapping(value = "/downloadByPolygon") |
| | | public void downloadByPolygon(String wkt, HttpServletResponse res) { |
| | | try { |
| | | // ... |
| | | |
| | | String filePath = "生成文件的路径"; |
| | | WebHelper.download(filePath, "文件名", res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |