| | |
| | | package com.lf.server.helper; |
| | | |
| | | import com.lf.server.entity.all.BaseGeoEntity; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.gdal.ogr.*; |
| | |
| | | |
| | | return Timestamp.valueOf(localDateTime); |
| | | } |
| | | |
| | | /** |
| | | * 创建GDB |
| | | */ |
| | | public static void createGdb(String filePath, Map<String, List<?>> map){ |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | | try{ |
| | | driver = ogr.GetDriverByName("OpenFileGDB"); |
| | | if (null == driver) { |
| | | return; |
| | | } |
| | | |
| | | dataSource = driver.CreateDataSource(filePath); |
| | | if (null == dataSource) { |
| | | return; |
| | | } |
| | | |
| | | for(String key : map.keySet()){ |
| | | GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(key); |
| | | if (null == baseMapper) { |
| | | continue; |
| | | } |
| | | |
| | | String tab = BaseQueryService.getTabName(baseMapper); |
| | | if (StringHelper.isNull(tab)) { |
| | | continue; |
| | | } |
| | | |
| | | String className = ClassHelper.getClassName(baseMapper); |
| | | Class clazz = ClassHelper.getEntityClass(className); |
| | | |
| | | List<?> list = map.get(key); |
| | | |
| | | } |
| | | }catch (Exception ex){ |
| | | log.error(ex.getMessage(), ex); |
| | | }finally { |
| | | GdbHelper.delete(dataSource, driver); |
| | | } |
| | | } |
| | | |
| | | private static <T> String getGeomType(GeomBaseMapper baseMapper, List<T> list) { |
| | | for (T t : list){ |
| | | if (!(t instanceof BaseGeoEntity)){ |
| | | return null; |
| | | } |
| | | |
| | | BaseGeoEntity entity = (BaseGeoEntity)t; |
| | | if (StringHelper.isEmpty(entity.getGeom())){ |
| | | continue; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |