Jelajahi Sumber

移动点目标条带计算

wurui 3 minggu lalu
induk
melakukan
806a341964

+ 28 - 0
orbit-base-biz/base-biz-service/pom.xml

@@ -133,6 +133,34 @@
             <version>0.0.1</version>
             <scope>compile</scope>
         </dependency>
+
+
+<!--        &lt;!&ndash; https://mvnrepository.com/artifact/org.geotools/gt-shapefile &ndash;&gt;
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-main</artifactId>
+            <version>21.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>nl.cloudfarming.client</groupId>
+            <artifactId>lib-geotools</artifactId>
+            <version>2.7.5</version>
+        </dependency>
+        &lt;!&ndash; https://mvnrepository.com/artifact/org.locationtech.jts/jts-core &ndash;&gt;
+        <dependency>
+            <groupId>org.locationtech.jts</groupId>
+            <artifactId>jts-core</artifactId>
+            <version>1.19.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.geotools</groupId>
+            <artifactId>gt-metadata</artifactId>
+            <version>24.6</version>
+        </dependency>-->
+
+
     </dependencies>
 
 

+ 8 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/controller/TargetDemandController.java

@@ -4,6 +4,7 @@ package com.base.biz.controller;
 import com.base.biz.model.dto.request.QueryTargetDemandDTO;
 import com.base.biz.model.dto.request.SatelliteTaskReqDTO;
 import com.base.biz.service.TargetDemandService;
+import com.base.biz.utils.FileUtils;
 import com.base.orbit.domain.AjaxResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -22,6 +23,13 @@ public class TargetDemandController {
     @Resource
     private TargetDemandService targetDemandService;
 
+    @ApiOperation(value = "目标列表查询")
+    @PostMapping("/selAllTargetList11")
+    public AjaxResult setaff(@RequestBody QueryTargetDemandDTO queryTargetDemandDTO) {
+        FileUtils.readInfo("","");
+        return targetDemandService.selAllTargetList(queryTargetDemandDTO);
+    }
+
     @ApiOperation(value = "目标列表查询")
     @PostMapping("/selAllTargetList")
     public AjaxResult selAllTargetList(@RequestBody QueryTargetDemandDTO queryTargetDemandDTO) {

+ 9 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/service/TargetDemandService.java

@@ -19,6 +19,7 @@ import com.base.biz.model.dto.request.*;
 import com.base.biz.model.dto.response.*;
 import com.base.biz.model.entity.*;
 import com.base.biz.model.enums.ReconnaissancePurposeEnums;
+import com.base.biz.utils.FileUtils;
 import com.base.orbit.Exception.AssertException;
 import com.base.orbit.domain.AjaxResult;
 import com.base.orbit.utils.BizUtils;
@@ -607,7 +608,15 @@ public class TargetDemandService extends ServiceImpl<TargetDemandMapper, TargetD
             SceneBasisTarget.setTargetType(0);
             SceneBasisTarget.setId(UUID.randomUUID().toString());
             SceneBasisTarget.setPointCount(queryTargetRelationPointAddDTO.getPointDTOList().size());
+
+     /*       String countryName ="未知";
+            if (!CollectionUtils.isEmpty(queryTargetRelationPointAddDTO.getPointDTOList())){
+                PointDTO pointDTO=queryTargetRelationPointAddDTO.getPointDTOList().get(0);
+                String  lat= String.valueOf(pointDTO.getLat());
+               *//* countryName=FileUtils.getcountryName(pointDTO);*//*
+            }*/
             SceneBasisTarget.setCountryName(queryTargetRelationPointAddDTO.getCountryName());
+
             SceneBasisTarget.setTargetLevel(queryTargetRelationPointAddDTO.getTargetLevel());
             SceneBasisTarget.setPointDirection(queryTargetRelationPointAddDTO.getPointDirection());
             SceneBasisTarget.setSource(1);

+ 81 - 0
orbit-base-biz/base-biz-service/src/main/java/com/base/biz/utils/FileUtils.java

@@ -0,0 +1,81 @@
+package com.base.biz.utils;
+
+
+
+
+
+
+/*import org.geotools.data.FeatureSource;
+import org.geotools.data.FileDataStore;
+import org.geotools.data.FileDataStoreFinder;
+import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureIterator;
+import org.geotools.geometry.jts.JTS;
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.Geometry;
+import org.opengis.feature.Property;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.geometry.BoundingBox;*/
+
+import java.io.File;
+
+import java.awt.*;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.nio.charset.Charset;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class FileUtils {
+
+    /**
+     */
+    public static String readInfo(String poingX, String pointY) {
+        return "";
+/*        try {
+            // shp文件路径
+*//*            ShapefileDataStore shpDataStore = new ShapefileDataStore(new File("D:\\xm\\duoxingyanshi\\12.shp").toURI().toURL());
+            shpDataStore.setStringCharset(Charset.forName("GBK"));*//*
+            File shapefile = new File("D:/xm/duoxingyanshi/12.shp");
+            FileDataStore store = FileDataStoreFinder.getDataStore(shapefile);
+            // 文件名称
+           String typeName = store.getTypeNames()[0];
+            FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = null;
+            featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) store.getFeatureSource(typeName);
+            FeatureCollection<SimpleFeatureType, SimpleFeature> result = featureSource.getFeatures();
+            FeatureIterator<SimpleFeature> itertor = result.features();
+            Geometry point = JTS.toGeometry((BoundingBox) new Coordinate(125.754000, 39.798000));
+
+            // 迭代iterator
+            boolean found = false;
+            String name="";
+            while (itertor.hasNext() && !found) {
+                SimpleFeature feature = itertor.next();
+                Geometry countryBoundary = (Geometry) feature.getDefaultGeometryProperty().getValue();
+                if (countryBoundary.contains(point)) {
+                    System.out.println("The point is in: " + feature.getAttribute("NAME") + " (" + feature.getAttribute("ISO2") + ")");
+                    name= String.valueOf(feature.getAttribute("NAME"));
+                    found = true;
+                }
+            }
+
+            if (!found) {
+                System.out.println("The point is not inside any country in the shapefile.");
+            }
+return   name;
+        } catch (Exception e) {
+            return   "name";
+        }*/
+
+    }
+
+
+
+
+}