| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.config.PropertiesConfig; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.DownloadTileEntity; |
| | | import com.lf.server.entity.ctrl.ShpRecordEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | |
| | | import com.lf.server.helper.StringHelper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class InquiryService { |
| | | @Resource |
| | | PropertiesConfig config; |
| | | |
| | | /** |
| | | * 读取Shp第一条记录的WKT |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 下载瓦片 |
| | | * 打包瓦片 |
| | | */ |
| | | public String downloadTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) { |
| | | public String zipTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) { |
| | | if (!TilePathExist(pub)) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> list = findTiles(dt, pub); |
| | | if (list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | return ""; |
| | | return "aaa"; |
| | | } |
| | | |
| | | /** |
| | | * 瓦片路径是否存在 |
| | | */ |
| | | private boolean TilePathExist(PublishEntity pub) { |
| | | String tilePath = config.getTilePath().replace("2d\\tiles", "") + File.separator + pub.getPath(); |
| | | |
| | | File f = new File(tilePath); |
| | | if (!f.exists() || !f.isDirectory()) { |
| | | return false; |
| | | } |
| | | |
| | | pub.setPath(tilePath); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查找瓦片 |
| | | */ |
| | | private List<String> findTiles(DownloadTileEntity dt, PublishEntity pub) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (int i = 0; i < StaticData.I23; i++) { |
| | | findTilesByZoom(dt, pub, i, list); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 根据层次查找瓦片 |
| | | */ |
| | | private void findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom, List<String> list) { |
| | | File f = new File(pub.getPath() + File.separator + zoom); |
| | | if (!f.exists() || !f.isDirectory()) { |
| | | return; |
| | | } |
| | | |
| | | // |
| | | } |
| | | } |