| | |
| | | import com.moon.server.entity.data.PublishEntity; |
| | | import com.moon.server.entity.shujian.*; |
| | | import com.moon.server.helper.HttpHelper; |
| | | import com.moon.server.helper.PathHelper; |
| | | import com.moon.server.helper.RestHelper; |
| | | import com.moon.server.helper.StringHelper; |
| | | import org.apache.commons.logging.Log; |
| | |
| | | |
| | | @Value("${shujian.url}") |
| | | String sjUrl; |
| | | |
| | | @Resource |
| | | PathHelper pathHelper; |
| | | |
| | | @Resource |
| | | MetaService metaService; |
| | |
| | | * 创建图层实体类 |
| | | */ |
| | | public CreateLayerEntity createLayerEntity(PubEntity pub) { |
| | | String epsg = getEpsg(pub); |
| | | String ids = StringHelper.join(pub.getIds(), ","); |
| | | List<MetaEntity> list = metaService.selectByIds(ids); |
| | | List<MetaEntity> metas = metaService.selectByIds(ids); |
| | | |
| | | CreateLayerEntity entity = new CreateLayerEntity(); |
| | | entity.setCreate_service(0); |
| | | |
| | | CreateLayerEntity.Layer layer = entity.getLayer(); |
| | | layer.setName(pub.getName()); |
| | | layer.setProjection(epsg); |
| | | layer.setProjection(getEpsg(pub)); |
| | | layer.setType(TYPES.indexOf(pub.getType())); |
| | | layer.setEnhance_type(pub.getEnhanceType()); |
| | | layer.setNodata(getNoData(pub, list)); |
| | | layer.setNodata(getNoData(pub, metas)); |
| | | |
| | | CreateLayerEntity.ImagePathList imagePathList = entity.getImage_path_list().get(0); |
| | | imagePathList.setPath(""); |
| | | imagePathList.setPath(pathHelper.getConfig().getUploadPath()); |
| | | |
| | | List<CreateLayerEntity.ImageList> imageLists = entity.getImage_list(); |
| | | CreateLayerEntity.ImageList imageList = imageLists.get(0); |
| | | imageList.setPath(""); |
| | | for (MetaEntity meta : metas) { |
| | | CreateLayerEntity.ImageList imageList = entity.new ImageList(); |
| | | imageList.setPath(meta.getPath()); |
| | | imageLists.add(imageList); |
| | | } |
| | | |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 获取EPSG编码 |
| | | */ |
| | | public String getEpsg(PubEntity pub) { |
| | | if (StaticData.I104903 == pub.getEpsgCode()) { |
| | | return "ESRI:" + pub.getEpsgCode(); |
| | | } |
| | | |
| | | return "EPSG:" + pub.getEpsgCode(); |
| | | } |
| | | |
| | | private List<String> getNoData(PubEntity pub, List<MetaEntity> metas) { |
| | |
| | | entity.setName(pub.getName()); |
| | | entity.setMin(pub.getMin()); |
| | | entity.setMax(pub.getMax()); |
| | | entity.setBak(getEpsg(pub)); |
| | | entity.setEpsg(pub.getEpsgCode()); |
| | | entity.setCreateUser(pub.getUserId()); |
| | | entity.setDirid(pub.getDircode()); |
| | | entity.setDepid(pub.getDepcode()); |
| | |
| | | entity.setJson(getColorTableJson(pub)); |
| | | |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 获取EPSG编码 |
| | | */ |
| | | public String getEpsg(PubEntity pub) { |
| | | if (StaticData.I104903 == pub.getEpsgCode()) { |
| | | return "ESRI:" + pub.getEpsgCode(); |
| | | } |
| | | |
| | | return "EPSG:" + pub.getEpsgCode(); |
| | | } |
| | | |
| | | /** |