燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-06-18 caa8596884dac891a8b5c4fcf85dd2f7a12812f5
src/main/java/com/yssh/utils/CalculateUtils.java
@@ -47,7 +47,7 @@
      s = s * EARTH_RADIUS1;
      return Math.round(s * 100) / 100;
      return round2(s);
   }
   /**
@@ -66,7 +66,11 @@
      // 计算距离,单位:米
      double distance = geodeticCalculator.getOrthodromicDistance();
      return Math.round(distance * 100) / 100;
      return round2(distance);
   }
   public static double round2(double d) {
      return ((long)(d * 100)) / 100D;
   }
   /**
@@ -84,13 +88,33 @@
         double angle = gc.getAzimuth();
         return Math.round(angle * 100) / 100;
         return round2(angle);
      } catch (Exception ex) {
         return 0;
      }
   }
   /**
    * 计算角度2
    */
   public static double getAngle2(double x1, double y1, double x2, double y2){
      try {
         DirectPosition2D p1 = new DirectPosition2D( x1, y1);
         DirectPosition2D p2 = new DirectPosition2D(x2, y2);
         GeodeticCalculator gc = new GeodeticCalculator();
         gc.setStartingGeographicPoint(p1);
         gc.setDestinationGeographicPoint(p2);
         double angle = gc.getAzimuth();
         return round2(angle);
      }catch (Exception ex){
         return 0;
      }
   }
   /**
    * 获取坐标
    * @param su
    * @return