|
@@ -2,10 +2,12 @@ package com.sysu.admin.site.lz;
|
|
|
|
|
|
import com.sysu.admin.controller.lz.area.LzArea;
|
|
import com.sysu.admin.controller.lz.area.LzArea;
|
|
import com.sysu.admin.controller.lz.area.LzAreaService;
|
|
import com.sysu.admin.controller.lz.area.LzAreaService;
|
|
|
|
+import com.sysu.admin.site.CommonVo;
|
|
import com.sysu.admin.utils.shape.GeoCastUtil;
|
|
import com.sysu.admin.utils.shape.GeoCastUtil;
|
|
import com.xiesx.fastboot.base.result.BaseResult;
|
|
import com.xiesx.fastboot.base.result.BaseResult;
|
|
import com.xiesx.fastboot.base.result.R;
|
|
import com.xiesx.fastboot.base.result.R;
|
|
import org.geotools.geometry.jts.JTSFactoryFinder;
|
|
import org.geotools.geometry.jts.JTSFactoryFinder;
|
|
|
|
+import org.locationtech.jts.geom.Coordinate;
|
|
import org.locationtech.jts.geom.GeometryFactory;
|
|
import org.locationtech.jts.geom.GeometryFactory;
|
|
import org.locationtech.jts.geom.MultiPolygon;
|
|
import org.locationtech.jts.geom.MultiPolygon;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@RequestMapping("/site/lz_area")
|
|
@RequestMapping("/site/lz_area")
|
|
@@ -32,6 +35,20 @@ public class LzAreaController {
|
|
return R.succ(list);
|
|
return R.succ(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @RequestMapping("/air_route")
|
|
|
|
+ public BaseResult airRoute(@RequestBody CommonVo commonVo){
|
|
|
|
+ LzArea area = lzAreaService.findOne(commonVo.getId().intValue());
|
|
|
|
+ Coordinate[] coordinates = area.getGeom().getCoordinates();
|
|
|
|
+ Double[][] res = new Double[coordinates.length - 1][];
|
|
|
|
+ for(int i=0; i < coordinates.length - 1; i++){
|
|
|
|
+ Double [] temp = new Double[2];
|
|
|
|
+ temp[0] = coordinates[i].getX();
|
|
|
|
+ temp[1] = coordinates[i].getY();
|
|
|
|
+ res[i] = temp;
|
|
|
|
+ }
|
|
|
|
+ return R.succ(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
@RequestMapping("/save")
|
|
@RequestMapping("/save")
|
|
public BaseResult save(@RequestBody LzArea bean){
|
|
public BaseResult save(@RequestBody LzArea bean){
|
|
bean.setGeom((MultiPolygon) GeoCastUtil.wktToGeom(bean.getWkt()));
|
|
bean.setGeom((MultiPolygon) GeoCastUtil.wktToGeom(bean.getWkt()));
|