|
@@ -289,7 +289,7 @@ public String shapeImport(MultipartFile[] files) {
|
|
|
|
|
|
#### 实现类使用方法
|
|
|
|
|
|
-```
|
|
|
+```java
|
|
|
public String txtImport(MultipartFile file) {
|
|
|
File txtFile = new File(file.getOriginalFilename());
|
|
|
String wkt = "";
|
|
@@ -318,6 +318,54 @@ public String shapeImport(MultipartFile[] files) {
|
|
|
|
|
|
#### 实体类使用方法
|
|
|
|
|
|
+```java
|
|
|
+public String dxfImport(MultipartFile file) {
|
|
|
+ File dxfFile = new File(file.getOriginalFilename());
|
|
|
+ String wkt = "";
|
|
|
+ try {
|
|
|
+ FileUtils.copyInputStreamToFile(file.getInputStream(), dxfFile);
|
|
|
+ wkt = DxfUtils.getWkt(dxfFile);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw ServiceExceptionUtil.exception(DXF_FILE_ERROR);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw ServiceExceptionUtil.exception(DXF_PARSE_ERROR);
|
|
|
+ } catch (LayerNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw ServiceExceptionUtil.exception(DXF_LAYER_NOT_FOUND_ERROR);
|
|
|
+ } finally {
|
|
|
+ dxfFile.delete();
|
|
|
+ }
|
|
|
+ return wkt;
|
|
|
+ }
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+### dwg导入获取wkt
|
|
|
+
|
|
|
+#### 实体类使用方法
|
|
|
+
|
|
|
+```java
|
|
|
+public String dwgImport(MultipartFile file) {
|
|
|
+ File dwgFile = new File(file.getOriginalFilename());
|
|
|
+ String wkt = "";
|
|
|
+ try {
|
|
|
+ FileUtils.copyInputStreamToFile(file.getInputStream(), dwgFile);
|
|
|
+ wkt = DwgUtils.getWkt(dwgFile);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw ServiceExceptionUtil.exception(DWG_FILE_ERROR);
|
|
|
+ } finally {
|
|
|
+ dwgFile.delete();
|
|
|
+ }
|
|
|
+ return wkt;
|
|
|
+ }
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
### pg入库wkt方法
|
|
|
|
|
|
```sql
|