| | |
| | | /** |
| | | * 读取数据 |
| | | */ |
| | | public static <T> List<T> readData(Class clazz, String filePath, String layerName) { |
| | | public static <T> List<T> readData(Class clazz, String filePath, String layerName, boolean isTransform) { |
| | | List<T> list = new ArrayList<>(); |
| | | |
| | | Driver driver = null; |
| | |
| | | for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { |
| | | Layer layer = dataSource.GetLayer(i); |
| | | if (layer.GetName().equals(layerName)) { |
| | | GdbHelper.readLayer(clazz, layer, list); |
| | | GdbHelper.readLayer(clazz, layer, list, isTransform); |
| | | break; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 读取图层 |
| | | */ |
| | | public static <T> void readLayer(Class clazz, Layer layer, List<T> list) { |
| | | public static <T> void readLayer(Class clazz, Layer layer, List<T> list, boolean isTransform) { |
| | | try { |
| | | Field gField = getGeomField(clazz); |
| | | |
| | |
| | | wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; |
| | | } |
| | | wkt = wkt.replace(" 0,", ",").replace(" 0)", ")"); |
| | | if (wkt.contains(StaticData.MULTICURVE)) { |
| | | wkt = wkt.replace("MULTICURVE (", "MULTILINESTRING (").replace("CIRCULARSTRING ", ""); |
| | | if (wkt.contains(StaticData.COMPOUNDCURVE)) { |
| | | wkt = wkt.replace("COMPOUNDCURVE (", "").replace(")))", "))"); |
| | | } |
| | | } |
| | | |
| | | geo = String.format("ST_GeomFromText('%s')", wkt); |
| | | } |