| | |
| | | package com.dji.sample.patches.service.impl; |
| | | |
| | | import com.dji.sample.common.error.CommonErrorEnum; |
| | | import com.dji.sample.component.mqtt.model.RequestsReply; |
| | | import com.dji.sample.patches.dao.ShpToDataSourceMapper; |
| | | import com.dji.sample.patches.model.entity.LotInfo; |
| | | import com.dji.sample.patches.service.ShpToDataSourceService; |
| | |
| | | |
| | | @Service |
| | | public class ShpToDataSourceServiceImpl implements ShpToDataSourceService { |
| | | |
| | | @Autowired |
| | | private ShpToDataSourceMapper mapper; |
| | | |
| | | @Autowired |
| | | private IWaylineFileService service; |
| | | String head = POLYGON; |
| | | // String sourceDir = "src/main/resources/template/wpmz/"; // 源文件夹路径 |
| | | String sourceDir = "/home/drone/server/template/wpmz/"; // 源文件夹路径 |
| | | |
| | | MultipartFile multipartFile; |
| | | |
| | | String json; |
| | | |
| | | public MultipartFile insertGeo(MultipartFile file, String workspaceId,String waylineName, double airportLat, double airportLon) throws Exception { |
| | | List<LotInfo> list = new ArrayList<>(); |
| | | MultipartFileTOFileUtil multipartFileTOFileUtil = new MultipartFileTOFileUtil(); |
| | |
| | | lotInfo.setXzb(Double.valueOf(points[0])); |
| | | lotInfo.setYzb(Double.valueOf(points[1])); |
| | | mapper.insert(lotInfo); |
| | | list.add(lotInfo); |
| | | } |
| | | Coordinate[] coordinates = GeoToolsUtil.getRoutePointOrder(list, airportLat, airportLon); |
| | | XMLTemplateModel xmlModel = XMLTemplateModel.init(coordinates, list); |
| | | CreateWaylineFileUtils.createWaylineFile(xmlModel); |
| | | // 压缩文件夹中的内容 |
| | | // String destKMZFile = "src/main/resources/template/kmz/"+waylineName+".kmz"; // 输出的KMZ文件路径 |
| | | String destKMZFile = "/home/drone/server/template/kmz/"+waylineName+".kmz"; // 输出的KMZ文件路径 |
| | | zipFolder(sourceDir, destKMZFile); |
| | | // multipartFile = convert(new File("src/main/resources/template/kmz/"+waylineName+".kmz")); |
| | | multipartFile = convert(new File("/home/drone/server/template/kmz/"+waylineName+".kmz")); |
| | | return multipartFile; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |