package com.siwei.spatial.controller.maths;


import com.siwei.common.core.web.controller.BaseController;
import com.siwei.common.core.web.domain.AjaxResult;
import com.siwei.spatial.service.maths.ISpatialMathsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 空间相关操作
 * <br>
 * 只使用java相关的库，不使用db
 * <br>
 * 所有接口先声明为内部接口
 *
 * @author siwei-zhx
 */
@RestController
@RequestMapping("/maths/jts")
public class SpatialMathsController extends BaseController {

    @Autowired
    private ISpatialMathsService iSpatialMathsService;

    /**
     * 获取空间的外接矩形
     *
     * @param geoms ewkt或者wkt的字符串
     * @return
     */
    @PostMapping("/envelope/ewkt")
    public AjaxResult getGeomEnvelope(@RequestBody List<String> geoms) {
        return AjaxResult.success("执行成功", iSpatialMathsService.getGeomEnvelope(geoms));
    }
}
