| | |
| | | import com.dji.sample.wayline.service.IWaylineFileService; |
| | | import org.locationtech.jts.geom.Coordinate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import java.io.File; |
| | |
| | | @Autowired |
| | | private IWaylineFileService service; |
| | | String head = POLYGON; |
| | | // String sourceDir = "src/main/resources/template/wpmz/"; // 源文件夹路径 |
| | | String sourceDir = "/home/drone/server/template/wpmz/"; // 源文件夹路径 |
| | | |
| | | @Value("${Patches.url.path.kmz.sourceDir}") |
| | | String sourceDir ; |
| | | @Value("${Patches.url.path.kmz.destKMZFile}") |
| | | String outkmz; |
| | | MultipartFile multipartFile; |
| | | |
| | | String json; |
| | |
| | | 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文件路径 |
| | | String destKMZFile = outkmz+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")); |
| | | multipartFile = convert(new File(destKMZFile)); |
| | | return multipartFile; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.tomcat.util.http.fileupload.FileItem; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | import java.util.UUID; |
| | | |
| | | public class MultipartFileTOFileUtil { |
| | | @Value("${Patches.url.path.unzip}") |
| | | String url; |
| | | //MultiparFile转File |
| | | public File multipartFile2File(MultipartFile multipartFile) { |
| | | String tmpFileDir = null; |
| | | // 创建临时文件 |
| | | String randomFileName = UUID.randomUUID().toString(); |
| | | tmpFileDir = "D:/tmp/" + randomFileName; |
| | | tmpFileDir = url+ randomFileName; |
| | | File file = new File(tmpFileDir); |
| | | InputStream inputStream = null; |
| | | FileOutputStream outputStream = null; |
| | |
| | | object-dir-prefix: |
| | | out-net-file-address: http://dev.jxpskj.com:9000 |
| | | |
| | | #图斑的解压地址和图斑文件转航线文件的地址 |
| | | Patches: |
| | | url: |
| | | path: |
| | | unzip: D:/tmp/ |
| | | kmz: |
| | | destKMZFile: src/main/resources/template/kmz/ |
| | | sourceDir: src/main/resources/template/wpmz/ |
| | |
| | | object-dir-prefix: |
| | | out-net-file-address: http://dev.jxpskj.com:9000 |
| | | |
| | | |
| | | #图斑的解压地址和图斑文件转航线文件的地址 |
| | | Patches: |
| | | url: |
| | | path: |
| | | unzip: /home/drone/server/temp |
| | | kmz: |
| | | destKMZFile: /home/drone/server/template/kmz/ |
| | | sourceDir: /home/drone/server/template/wpmz/ |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.86,28.6203 |
| | | 115.8576,28.5751 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>0</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.86,28.6142 |
| | | 115.8576,28.5729 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>1</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8664,28.6142 |
| | | 115.8591,28.5729 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>2</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8664,28.6203 |
| | | 115.8591,28.5751 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>3</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8643,28.6357 |
| | | 115.8834,28.5772 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>4</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8643,28.6331 |
| | | 115.8834,28.5721 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>5</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.867,28.6331 |
| | | 115.8875,28.5721 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>6</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.867,28.6357 |
| | | 115.8875,28.5772 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>7</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.841,28.6317 |
| | | 115.86,28.6203 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>8</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.841,28.6305 |
| | | 115.86,28.6142 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>9</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.844,28.6305 |
| | | 115.8664,28.6142 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>10</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.844,28.6317 |
| | | 115.8664,28.6203 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>11</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8381,28.6187 |
| | | 115.8643,28.6357 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>12</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8381,28.6161 |
| | | 115.8643,28.6331 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>13</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8413,28.6161 |
| | | 115.867,28.6331 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>14</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8413,28.6187 |
| | | 115.867,28.6357 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>15</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8059,28.6239 |
| | | 115.841,28.6317 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>16</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8059,28.622 |
| | | 115.841,28.6305 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>17</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8102,28.622 |
| | | 115.844,28.6305 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>18</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8102,28.6239 |
| | | 115.844,28.6317 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>19</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8297,28.6659 |
| | | 115.8381,28.6187 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>20</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8297,28.6604 |
| | | 115.8381,28.6161 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>21</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.837,28.6604 |
| | | 115.8413,28.6161 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>22</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.837,28.6659 |
| | | 115.8413,28.6187 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>23</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8575,28.6791 |
| | | 115.8059,28.6239 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>24</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8575,28.6762 |
| | | 115.8059,28.622 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>25</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8637,28.6762 |
| | | 115.8102,28.622 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>26</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8637,28.6791 |
| | | 115.8102,28.6239 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>27</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.9122,28.6232 |
| | | 115.8297,28.6659 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>28</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.9122,28.6212 |
| | | 115.8297,28.6604 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>29</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.916,28.6212 |
| | | 115.837,28.6604 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>30</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.916,28.6232 |
| | | 115.837,28.6659 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>31</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8834,28.5772 |
| | | 115.8575,28.6791 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>32</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8834,28.5721 |
| | | 115.8575,28.6762 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>33</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8875,28.5721 |
| | | 115.8637,28.6762 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>34</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8875,28.5772 |
| | | 115.8637,28.6791 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>35</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8576,28.5751 |
| | | 115.9122,28.6232 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>36</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8576,28.5729 |
| | | 115.9122,28.6212 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>37</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8591,28.5729 |
| | | 115.916,28.6212 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>38</wpml:index> |
| | |
| | | <Placemark> |
| | | <Point> |
| | | <coordinates> |
| | | 115.8591,28.5751 |
| | | 115.916,28.6232 |
| | | </coordinates> |
| | | </Point> |
| | | <wpml:index>39</wpml:index> |