DESKTOP-2K9OVK9\siwei 1 tháng trước cách đây
mục cha
commit
0c0c124737

+ 41 - 38
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java

@@ -235,72 +235,75 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
                 writeheading = dr_mr.toString();
                 for (int i = 0; i < flightDtoList.size(); i++) {
                     TGdbhFlightDto dto = flightDtoList.get(i);
+                    Double dr_hou4 = 0.0;
+                    Double dr_hou = dr_mr;
                     if (i > 0 && i + 1 < len) {
                         TGdbhFlightDto dto_hou = flightDtoList.get(i + 1);
-                        Double dr_hou = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto.getLongitude(), dto.getLatitude(), dto_hou.getLongitude(), dto_hou.getLatitude()));
+                        dr_hou = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto.getLongitude(), dto.getLatitude(), dto_hou.getLongitude(), dto_hou.getLatitude()));
                         if (Math.abs(Double.parseDouble(writeheading) - dr_hou) > 10) {
                             writeheading = dr_hou.toString();
                         }
-                        Double dr_hou4 = dr_hou;
                         if (i + 5 <= len) {
+                            TGdbhFlightDto dto_hou2 = flightDtoList.get(i + 2);
+                            Double dr_hou0 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou.getLongitude(), dto_hou.getLatitude(), dto_hou2.getLongitude(), dto_hou2.getLatitude()));
+                            dr_hou4 = Math.abs(dr_hou - dr_hou0);
                             if (dr_hou4 <= 10) {
-                                TGdbhFlightDto dto_hou2 = flightDtoList.get(i + 2);
-                                dr_hou4 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou.getLongitude(), dto_hou.getLatitude(), dto_hou2.getLongitude(), dto_hou2.getLatitude()));
+                                TGdbhFlightDto dto_hou3 = flightDtoList.get(i + 3);
+                                Double dr_hou1 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou2.getLongitude(), dto_hou2.getLatitude(), dto_hou3.getLongitude(), dto_hou3.getLatitude()));
+                                dr_hou4 = Math.abs(dr_hou0 - dr_hou1);
                                 if (dr_hou4 <= 10) {
-                                    TGdbhFlightDto dto_hou3 = flightDtoList.get(i + 3);
-                                    dr_hou4 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou2.getLongitude(), dto_hou2.getLatitude(), dto_hou3.getLongitude(), dto_hou3.getLatitude()));
-                                    if (dr_hou4 <= 10) {
-                                        TGdbhFlightDto dto_hou4 = flightDtoList.get(i + 4);
-                                        dr_hou4 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou3.getLongitude(), dto_hou3.getLatitude(), dto_hou4.getLongitude(), dto_hou4.getLatitude()));
-                                    }
+                                    TGdbhFlightDto dto_hou4 = flightDtoList.get(i + 4);
+                                    Double dr_hou2 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou3.getLongitude(), dto_hou3.getLatitude(), dto_hou4.getLongitude(), dto_hou4.getLatitude()));
+                                    dr_hou4 = Math.abs(dr_hou1 - dr_hou2);
                                 }
                             }
-                        } else if (i + 5 > len) {
-                            dr_hou4 = dr_hou + 15;
                         }
+                    } else if (i + 5 > len) {
+                        dr_hou4 = dr_hou4 + 15;
+                    }
 
-                        Double dr4 = Math.abs(dr_hou - dr_hou4);
-                        if (dr4 > 10) {
-                            writetilt = "0.100000000000000006";
+                    Double dr4 = dr_hou4;
+                    if (dr4 > 10) {
+                        writetilt = "0.100000000000000006";
 //                            writeheading = heading;
-                        } else {
-                            Double dr = Math.abs(dr_mr - dr_hou);
-                            if (dr > 10 && dr < 160) {
-                                writetilt = "0.100000000000000006";
+                    } else {
+                        Double dr = Math.abs(dr_mr - dr_hou);
+                        if (dr > 10 && dr < 160) {
+                            writetilt = "0.100000000000000006";
 //                                writeheading = heading;
-                            } else if (dr > 160) {
+                        } else if (dr > 160) {
 //                        writetilt = (360 - Double.parseDouble(tilt)) + "";
 //                                if ("180.0".equals(writeheading)) {
 //                                    writeheading = "0.000001";
 //                                } else {
 //                                    writeheading = "180.0";
 //                                }
-                                writetilt = tilt;
-                            } else {
-                                writetilt = tilt;
+                            writetilt = tilt;
+                        } else {
+                            writetilt = tilt;
 //                                writeheading = heading;
-                            }
                         }
                     }
-                    String height = dto.getHeight();
-                    if (null != tGdbhFlightBatchDto) {
-                        if (StringUtils.isNotEmpty(tGdbhFlightBatchDto.getHeight())) {
-                            height = tGdbhFlightBatchDto.getHeight();
-                        }
+                }
+                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>" + writeheading + "</heading>" + "<tilt>" + writetilt + "</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(); // 写入换行
                 }
-                writer.write("</route>");
-                writer.newLine(); // 写入换
-                writer.write("</SceneRoute>");
-                System.out.println("File written successfully!");
-            } catch (IOException e) {
-                System.err.println("Error writing file: " + e.getMessage());
+                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>" + writeheading + "</heading>" + "<tilt>" + writetilt + "</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(); // 写入换行
             }
+            writer.write("</route>");
+            writer.newLine(); // 写入换
+            writer.write("</SceneRoute>");
+            System.out.println("File written successfully!");
+        } catch(IOException e){
+            System.err.println("Error writing file: " + e.getMessage());
         }
     }
+}
 
 
 }