| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ShapeFile帮助类 |
| | | * @author WWW |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | public class ShpHelper { |
| | | private final static Log log = LogFactory.getLog(ShpHelper.class); |
| | | |
| | | /** |
| | | * 读取Shp第一条记录的WKT |
| | | */ |
| | | public static ShpRecordEntity readShpFirstRecord(String filePath) { |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取ShapeFile文件获取Mark实体类 |
| | | */ |
| | | public static List<MarkJsonEntity> readShpForMarks(String filePath) { |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取shp字段信息 |
| | | */ |
| | | private static Map<Integer, Field> getShpFields(Layer layer) { |
| | | FeatureDefn featureDefn = layer.GetLayerDefn(); |
| | | |
| | |
| | | return fields; |
| | | } |
| | | |
| | | /** |
| | | * 设置标绘实体类 |
| | | */ |
| | | private static List<MarkJsonEntity> setMarkJsonEntity(Layer layer, Map<Integer, Field> fieldMap) throws Exception { |
| | | List<MarkJsonEntity> list = new ArrayList<>(); |
| | | for (int i = 0; i < layer.GetFeatureCount(); i++) { |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 创建ShapeFile文件 |
| | | * |
| | | * @param list 标绘JSON实体类集合 |
| | | * @param path 路径 |
| | | * @param type 类型:POINT,LINESTRING,POLYGON |
| | | * @return ShapeFile文件名 |
| | | */ |
| | | public static String createShp(List<MarkJsonEntity> list, String path, String type) { |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取图形类型 |
| | | */ |
| | | private static int getGeometryType(String type) { |
| | | switch (type) { |
| | | case "POINT": |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取数据 |
| | | */ |
| | | public static <T> List<T> readData(Class clazz, String filePath, boolean isTransform) { |
| | | List<T> list = new ArrayList<>(); |
| | | |