Exemplo n.º 1
0
  /**
   * Return the distance between that lat/lons defined in radians. The returned value is in radians
   * and LINETYPE is taken into consideration. LINETYPE_STRAIGHT returns same as
   * LINETYPE_GREATCIRCLE, the ground distance between all nodes and not the degree distance of the
   * lines.
   */
  public double getDist(Geo g1, Geo g2) {
    switch (getLineType()) {
      case LINETYPE_RHUMB:
        double[] coords =
            new double[] {
              g1.getLatitudeRadians(),
              g1.getLongitudeRadians(),
              g2.getLatitudeRadians(),
              g2.getLongitudeRadians()
            };
        return ProjMath.distance(LineCoordinateGenerator.fromRadians(coords).rhumbLineDoubles());

      case LINETYPE_STRAIGHT:
      case LINETYPE_GREATCIRCLE:
      case LINETYPE_UNKNOWN:
      default:
        return g1.distance(g2);
    }
  }