|
@@ -6,6 +6,7 @@ import com.onemap.common.core.utils.StringUtils;
|
|
|
import com.onemap.common.core.web.domain.AjaxResult;
|
|
|
import com.onemap.common.core.web.domain.RequestResult;
|
|
|
import com.onemap.common.security.utils.SecurityUtils;
|
|
|
+import com.onemap.file.domain.EwktTotEnvelopeVo;
|
|
|
import com.onemap.file.domain.SpaceFileRecordDTO;
|
|
|
import com.onemap.file.domain.TUploadGeomDTO;
|
|
|
import com.onemap.file.domain.TUploadGeomDetailsDTO;
|
|
@@ -25,24 +26,19 @@ import com.onemap.system.api.domain.RawTableVo;
|
|
|
import com.onemap.file.domain.res.ApiTTable;
|
|
|
import com.onemap.file.domain.res.ApiTTableFiled;
|
|
|
import com.onemap.file.domain.res.TableDataVo;
|
|
|
-import org.apache.commons.io.IOUtils;
|
|
|
+import org.locationtech.jts.geom.Geometry;
|
|
|
+import org.locationtech.jts.geom.GeometryCollection;
|
|
|
+import org.locationtech.jts.geom.GeometryFactory;
|
|
|
+import org.locationtech.jts.io.ParseException;
|
|
|
+import org.locationtech.jts.io.WKTReader;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-import org.springframework.web.util.UriUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.annotation.processing.FilerException;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
@@ -423,4 +419,26 @@ public class SpaceFileRecordServiceImpl implements ISpaceFileRecordService {
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String readEwktTotEnvelope(EwktTotEnvelopeVo vo) throws ParseException {
|
|
|
+ if (vo == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ GeometryFactory geometryFactory = new GeometryFactory();
|
|
|
+ List<Geometry> list = new ArrayList<>();
|
|
|
+ for (String wkt : vo.getEwkt()) {
|
|
|
+ if (StringUtils.isNotEmpty(wkt)) {
|
|
|
+ wkt = wkt.replaceFirst("^SRID=\\d+;", "");
|
|
|
+ Geometry geometry_d0 = new WKTReader().read(wkt);
|
|
|
+ list.add(geometry_d0.getEnvelope());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ Geometry[] integersArray2 = list.toArray(new Geometry[list.size()]);
|
|
|
+ GeometryCollection geometryCollection = geometryFactory.createGeometryCollection(integersArray2);
|
|
|
+ return geometryCollection.union().getEnvelope().toText();
|
|
|
+ }
|
|
|
}
|