Sfoglia il codice sorgente

Merge branch 'dev'

gushoubang 1 mese fa
parent
commit
f939a8adf7

+ 37 - 15
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/TGdbhGdServiceImpl.java

@@ -232,44 +232,65 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
                 TGdbhFlightDto dto_0 = flightDtoList.get(0);
                 TGdbhFlightDto dto_1 = flightDtoList.get(1);
                 Double dr_mr = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_0.getLongitude(), dto_0.getLatitude(), dto_1.getLongitude(), dto_1.getLatitude()));
-
+                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()));
-                        Double dr_hou4 = dr_hou;
-                        if (i + 5 <= len) {
+                        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();
+                        }
+                        if (i + 7 <= len) {
                             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()));
+                            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_hou3 = flightDtoList.get(i + 3);
-                                dr_hou4 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou2.getLongitude(), dto_hou2.getLatitude(), dto_hou3.getLongitude(), dto_hou3.getLatitude()));
+                                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_hou4 = flightDtoList.get(i + 4);
-                                    dr_hou4 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou3.getLongitude(), dto_hou3.getLatitude(), dto_hou4.getLongitude(), dto_hou4.getLatitude()));
+                                    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);
+                                    if (dr_hou4 <= 10) {
+                                        TGdbhFlightDto dto_hou5 = flightDtoList.get(i + 5);
+                                        Double dr_hou5 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou4.getLongitude(), dto_hou4.getLatitude(), dto_hou5.getLongitude(), dto_hou5.getLatitude()));
+                                        dr_hou4 = Math.abs(dr_hou2 - dr_hou5);
+                                        if (dr_hou4 <= 10) {
+                                            TGdbhFlightDto dto_hou6 = flightDtoList.get(i + 6);
+                                            Double dr_hou6 = Double.valueOf(tGdbhFlightMapper.stAzimuth(dto_hou5.getLongitude(), dto_hou5.getLatitude(), dto_hou6.getLongitude(), dto_hou6.getLatitude()));
+                                            dr_hou4 = Math.abs(dr_hou5 - dr_hou6);
+                                        }
+                                    }
                                 }
                             }
-                        } else if (i + 5 > len) {
-                            dr_hou4 = dr_hou + 15;
+                        } else if (i + 7 > len) {
+                            dr_hou4 = dr_hou4 + 15;
                         }
 
-                        Double dr4 = Math.abs(dr_hou - dr_hou4);
+                        Double dr4 = dr_hou4;
                         if (dr4 > 10) {
                             writetilt = "0.100000000000000006";
-                            writeheading = heading;
+//                            writeheading = heading;
                         } else {
                             Double dr = Math.abs(dr_mr - dr_hou);
                             if (dr > 10 && dr < 160) {
                                 writetilt = "0.100000000000000006";
-                                writeheading = heading;
+//                                writeheading = heading;
                             } else if (dr > 160) {
 //                        writetilt = (360 - Double.parseDouble(tilt)) + "";
-                                writeheading = "180.0";
+//                                if ("180.0".equals(writeheading)) {
+//                                    writeheading = "0.000001";
+//                                } else {
+//                                    writeheading = "180.0";
+//                                }
                                 writetilt = tilt;
                             } else {
                                 writetilt = tilt;
-                                writeheading = heading;
+//                                writeheading = heading;
                             }
                         }
                     }
@@ -287,7 +308,8 @@ public class TGdbhGdServiceImpl implements ITGdbhGdService {
                 writer.newLine(); // 写入换
                 writer.write("</SceneRoute>");
                 System.out.println("File written successfully!");
-            } catch (IOException e) {
+            } catch (
+                    IOException e) {
                 System.err.println("Error writing file: " + e.getMessage());
             }
         }