| | |
| | | import com.ard.work.service.ITyService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import static com.ard.route.enums.kml.DroneEnumValueEnums.M350_RTK; |
| | | import static com.ard.route.util.InitializationUtils.divided_23; |
| | | import static com.ard.route.util.InitializationUtils.divided_6; |
| | | import static com.ard.route.util.ToolUtils.*; |
| | | import static com.ard.route.util.UavRouteReqUtils.fileConversionEntity; |
| | | |
| | |
| | | } catch (IOException | ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | // 主逻辑优化 |
| | | double altitudeOffset = getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(), "alt"); |
| | | boolean isM350RTK = M350_RTK.getValue().equals(ardRouteInfo.getUavRouteReq().getDroneType()); |
| | | |
| | | for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt")); |
| | | // 判断无人机类型 |
| | | if (ardRouteInfo.getUavRouteReq().getDroneType().equals(89)){ |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | // 调整航点高度 |
| | | adjustRoutePointHeight(routePointReq, altitudeOffset); |
| | | // 如果是M350_RTK无人机,处理变焦动作 |
| | | // if (isM350RTK && routePointReq.getActionGroupList() != null) { |
| | | // for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | // if (actionGroupReq != null && actionGroupReq.getActions() != null) { |
| | | // processZoomActions(actionGroupReq); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | return ardRouteInfo; |
| | | } |
| | | |
| | | // 变焦放大缩小 |
| | | public void zoom(){ |
| | | // 提取航点高度调整逻辑到方法中 |
| | | private void adjustRoutePointHeight(RoutePointReq routePointReq, double altitudeOffset) { |
| | | routePointReq.setHeight(routePointReq.getHeight() + altitudeOffset); |
| | | } |
| | | |
| | | // 提取变焦值处理逻辑到方法中 |
| | | private void processZoomActions(ActionGroupReq actionGroupReq) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | if (action != null && action.getZoom() != null) { |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | }else if ("0".equals(ardRouteInfo.getOrderByTime())) { |
| | | ardRouteInfo.setOrderByTime("ASC"); |
| | | } |
| | | // List<ArdRouteInfo> list = ardRouteInfoMapper.selectArdRouteInfoList(ardRouteInfo); |
| | | // for (ArdRouteInfo routeInfo : list) { |
| | | // for (RoutePointReq routePointReq : routeInfo.getUavRouteReq().getRoutePointList()) { |
| | | // routePointReq.setHeight(routePointReq.getHeight() + getDoublePoint(ardRouteInfo.getUavRouteReq().getTakeOffRefPoint(),"alt")); |
| | | // } |
| | | // } |
| | | return ardRouteInfoMapper.selectArdRouteInfoList(ardRouteInfo); |
| | | } |
| | | |
| | |
| | | if (ardRouteInfo.getGroupId() == null){ |
| | | ardRouteInfo.setGroupId("0"); |
| | | } |
| | | UavRouteReq uavRouteReq = new UavRouteReq(); |
| | | BeanUtils.copyProperties(ardRouteInfo.getUavRouteReq(), uavRouteReq); |
| | | ardRouteInfo.getUavRouteReq().setDroneType(subStringDroneType(ardRouteInfo.getAircraft())); |
| | | KmzResultVo kmzResult = routeService.buildKmz(ardRouteInfo.getUavRouteReq(),ardRouteInfo.getName()); |
| | | KmzResultVo kmzResult = routeService.buildKmz(uavRouteReq,ardRouteInfo.getName()); |
| | | if (M350_RTK.getValue().equals(uavRouteReq.getDroneType())) { |
| | | // 变焦数值加工 |
| | | for (RoutePointReq routePointReq : ardRouteInfo.getUavRouteReq().getRoutePointList()) { |
| | | for (ActionGroupReq actionGroupReq : routePointReq.getActionGroupList()) { |
| | | for (PointActionReq action : actionGroupReq.getActions()) { |
| | | action.setZoom(divided_23(action.getZoom())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ardRouteInfo.setPath(kmzResult.getPath()); |
| | | ardRouteInfo.setReadOnly("0"); |
| | | ardRouteInfoMapper.insertArdRouteInfo(dataProcessing(ardRouteInfo)); |