| | |
| | | import com.ruoyi.device.camera.domain.CameraCmd;
|
| | | import com.ruoyi.device.camera.service.IArdCamerasService;
|
| | | import com.ruoyi.device.camera.service.ICameraSdkService;
|
| | |
|
| | | import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
|
| | | import com.ruoyi.device.noguidezone.service.IArdCameraNoGuideZoneService;
|
| | | import com.ruoyi.utils.gis.GisUtil;
|
| | | import com.ruoyi.utils.gis.Point;
|
| | | import io.swagger.annotations.Api;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | private ICameraSdkService cameraSdkService;
|
| | | @Resource
|
| | | private IArdCamerasService ardCamerasService;
|
| | |
|
| | | @Autowired
|
| | | private IArdCameraNoGuideZoneService ardCameraNoGuideZoneService;
|
| | |
|
| | |
|
| | | @RequestMapping("/preview")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult PTZControlWithSpeed(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.pTZControl(cmd));
|
| | | return cameraSdkService.pTZControl(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("调用预置点")
|
| | |
| | | Map<String, Object> ptzMap = cameraSdkService.getPtz(cmd);
|
| | | return AjaxResult.success("获取ptz", ptzMap);
|
| | | }
|
| | |
|
| | | @ApiOperation("获取PTZ范围")
|
| | | @PostMapping("/getPTZScope")
|
| | | @Log(title = "获取PTZ范围", businessType = BusinessType.CONTROL)
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setPTZ(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return toAjax(cameraSdkService.setPtz(cmd));
|
| | | return cameraSdkService.setPtz(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("指向目标")
|
| | |
| | | public @ResponseBody
|
| | | AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | //拦截手动引导
|
| | | ArdCameraNoGuideZone ardCameraNoGuideZone = new ArdCameraNoGuideZone();
|
| | | ardCameraNoGuideZone.setCameraId(cmd.getCameraId());
|
| | | ardCameraNoGuideZone.setEnabled("1");
|
| | | //获取当前相机的禁引可视域列表
|
| | | List<ArdCameraNoGuideZone> ardCameraNoGuideZones = ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
|
| | | if (ardCameraNoGuideZones.size() > 0) {
|
| | | //获取到当前相机的坐标集合
|
| | | for(ArdCameraNoGuideZone zone:ardCameraNoGuideZones) {
|
| | | String[] parts = zone.getPoi().split(",");
|
| | | List<Point> pointList = new ArrayList<>();
|
| | | for (int i = 0; i < parts.length; i += 3) {
|
| | | Point point = new Point();
|
| | | point.setLongitude(Double.valueOf(parts[i]));
|
| | | point.setLatitude(Double.valueOf(parts[i + 1]));
|
| | | pointList.add(point);
|
| | | }
|
| | | double lon = cmd.getTargetPosition()[0];
|
| | | double lat = cmd.getTargetPosition()[1];
|
| | | Point targetPoint = new Point(lon, lat);
|
| | | //判断引导目标是否在坐标集合组成的多边形内
|
| | | boolean inPolygon = GisUtil.isInPolygon(targetPoint, pointList);
|
| | | if(inPolygon)
|
| | | {
|
| | | return AjaxResult.error("引导坐标位于禁引可视域内");
|
| | | }
|
| | | }
|
| | | }
|
| | | return toAjax(cameraSdkService.guideTargetPosition(cmd));
|
| | | }
|
| | |
|
| | | @ApiOperation("指向目标井")
|
| | | @PostMapping("/setTargetWell")
|
| | | @Log(title = "指向目标井", businessType = BusinessType.CONTROL)
|
| | | @ApiOperationSupport(includeParameters = {"cmd.wellId"})
|
| | | public @ResponseBody
|
| | | AjaxResult setTargetWell(@RequestBody CameraCmd cmd) {
|
| | | cmd.setOperator(SecurityUtils.getUserId());
|
| | | return cameraSdkService.guideTargetWell(cmd);
|
| | | }
|
| | |
|
| | | @ApiOperation("设置零方位角")
|
| | | @PostMapping("/setZeroPTZ")
|