Explorar el Código

飞行添加转向

DESKTOP-2K9OVK9\siwei hace 3 días
padre
commit
be3247973b

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhFlightBatchMapper.java

@@ -6,6 +6,6 @@ import java.util.List;
 
 public interface TGdbhFlightBatchMapper {
 
-    public List<TGdbhFlightBatchDto> selectList();
+    public List<TGdbhFlightBatchDto> selectList(TGdbhFlightBatchDto tGdbhFlightBatchDto);
 
 }

+ 3 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/TGdbhFlightMapper.java

@@ -1,6 +1,7 @@
 package com.onemap.apply.mapper.gdbh;
 
 import com.onemap.apply.domain.gdbh.TGdbhFlightDto;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -8,4 +9,6 @@ public interface TGdbhFlightMapper {
 
     public List<TGdbhFlightDto> selectList(TGdbhFlightDto dto);
 
+    public Float stAzimuth(@Param("longitude") String longitude, @Param("latitude") String latitude,
+                           @Param("t_longitude") String t_longitude, @Param("t_latitude") String t_latitude);
 }

+ 25 - 27
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java

@@ -163,7 +163,7 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
 
     @Override
     public List<TGdbhFlightBatchDto> uavQuery(TGdbhFlightBatchDto tGdbhFlightBatchDto) {
-        List<TGdbhFlightBatchDto> bathDtos = tGdbhFlightBatchMapper.selectList();
+        List<TGdbhFlightBatchDto> bathDtos = tGdbhFlightBatchMapper.selectList(tGdbhFlightBatchDto);
         for (TGdbhFlightBatchDto bathDto : bathDtos) {
             if (StringUtils.isNotEmpty(bathDto.getBatch())) {
                 String fpfPath = "/gdbh/flight/batch_video/" + bathDto.getBatch().trim() + ".fpf";
@@ -222,40 +222,38 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
             writer.newLine(); // 写入换行
             writer.write("</style>");
             writer.newLine(); // 写入换行
+            int len = flightDtoList.size();
             for (int i = 0; i < flightDtoList.size(); i++) {
                 TGdbhFlightDto dto = flightDtoList.get(i);
+                if (i > 0 && i + 1 < len) {
+                    TGdbhFlightDto dto_qian = flightDtoList.get(i - 1);
+                    TGdbhFlightDto dto_hou = flightDtoList.get(i + 1);
+                    Double dr_qian = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto.getLongitude(), dto.getLatitude(), dto_qian.getLongitude(), dto_qian.getLatitude()));
+                    Double dr_hou = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou.getLongitude(), dto_hou.getLatitude(), dto.getLongitude(), dto.getLatitude()));
+//                    System.out.println("dr_qian:" + dr_qian);
+//                    System.out.println("dr_hou:" + dr_hou);
+                    Double dr = Math.abs(dr_hou - dr_qian);
+                    if (dr > 10) {
+                        tilt = "0.100000000000000006";
+                    }
+                    if (i > 3) {
+                        TGdbhFlightDto dto_pingxing2 = flightDtoList.get(i - 2);
+                        TGdbhFlightDto dto_pingxing3 = flightDtoList.get(i - 3);
+                        Double dr_pingxing = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_pingxing3.getLongitude(), dto_pingxing3.getLatitude(), dto_pingxing2.getLongitude(), dto_pingxing2.getLatitude()));
+                        Double dr_px = Math.abs(dr_qian - dr_pingxing);
+                        if (dr_px > 160) {
+                            tilt = "0.100000000000000006";
+                            heading = (360 - Double.parseDouble(heading)) + "";
+                        }
+                    }
+                }
                 String height = dto.getHeight();
                 if (null != tGdbhFlightBatchDto) {
                     if (StringUtils.isNotEmpty(tGdbhFlightBatchDto.getHeight())) {
                         height = tGdbhFlightBatchDto.getHeight();
                     }
                 }
-                String fpf = "<routestop name=\"" + dto.getPhoto_name() + "\" speed=\"0\" excluded=\"False\" viewType=\"camera\">" +
-                        "<camera>" +
-                        "<longitude>" + dto.getLongitude() + "</longitude>" +
-                        "<latitude>" + dto.getLatitude() + "</latitude>" +
-                        "<altitude>" + height + "</altitude>" +
-                        "<heading>" + heading + "</heading>" +
-                        "<tilt>" + tilt + "</tilt>" +
-                        "<altitudeMode>Absolute</altitudeMode>" +
-                        "</camera>" +
-                        "<style>" +
-                        "<geostyle3d>" +
-                        "<icon/>" +
-                        "<markersize>4.8</markersize>" +
-                        "<markericonscale>1</markericonscale>" +
-                        "<markercolor>RGBA(255,255,255,255)</markercolor>" +
-                        "</geostyle3d>" +
-                        "</style>" +
-                        "<setting>" +
-                        "<turnTime>1.5</turnTime>" +
-                        "<turnSlowly>False</turnSlowly>" +
-                        "<stopPlayMode>StopPause</stopPlayMode>" +
-                        "<autoPlay>False</autoPlay>" +
-                        "<pauseTime>0</pauseTime>" +
-                        "<angularSpeed>1</angularSpeed>" +
-                        "</setting>" +
-                        "</routestop>";
+                String fpf = "<routestop name=\"" + dto.getPhoto_name() + "\" speed=\"0\" excluded=\"False\" viewType=\"camera\">" + "<camera>" + "<longitude>" + dto.getLongitude() + "</longitude>" + "<latitude>" + dto.getLatitude() + "</latitude>" + "<altitude>" + height + "</altitude>" + "<heading>" + heading + "</heading>" + "<tilt>" + tilt + "</tilt>" + "<altitudeMode>Absolute</altitudeMode>" + "</camera>" + "<style>" + "<geostyle3d>" + "<icon/>" + "<markersize>4.8</markersize>" + "<markericonscale>1</markericonscale>" + "<markercolor>RGBA(255,255,255,255)</markercolor>" + "</geostyle3d>" + "</style>" + "<setting>" + "<turnTime>1.5</turnTime>" + "<turnSlowly>False</turnSlowly>" + "<stopPlayMode>StopPause</stopPlayMode>" + "<autoPlay>False</autoPlay>" + "<pauseTime>0</pauseTime>" + "<angularSpeed>1</angularSpeed>" + "</setting>" + "</routestop>";
                 writer.write(fpf);
                 writer.newLine(); // 写入换行
             }

+ 6 - 1
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhFlightBathMapper.xml

@@ -11,9 +11,14 @@
     </resultMap>
 
 
-    <select id="selectList" resultMap="TGdbhFlightBatchDtoResult">
+    <select id="selectList" parameterType="TGdbhFlightBatchDto" resultMap="TGdbhFlightBatchDtoResult">
         SELECT *
         FROM t_gdbh_flight_bath inTbale
+        <where>
+            <if test="batch!=null and batch!='' ">
+                and batch = #{batch}
+            </if>
+        </where>
         order by batch_time asc
     </select>
 

+ 9 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gdbh/TGdbhFlightMapper.xml

@@ -36,4 +36,13 @@
         order by photo_name asc
     </select>
 
+
+    <select id="stAzimuth" resultType="float" >
+        SELECT degrees(public.ST_Azimuth(
+                public.ST_SetSRID(public.ST_MakePoint(#{longitude}::FLOAT, #{latitude}::FLOAT), 4326),
+                public.ST_SetSRID(public.ST_MakePoint(#{t_longitude}::FLOAT, #{t_latitude}::FLOAT), 4326)
+            )
+        ) AS azimuth_degrees
+    </select>
+
 </mapper>