Class LatLng

  • All Implemented Interfaces:
    android.os.Parcelable, Coord

    public final class LatLng
    extends java.lang.Object
    implements Coord, android.os.Parcelable
    위경도 좌표를 나타내는 클래스.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T extends java.lang.Object>, android.os.Parcelable.Creator<T extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      LatLng​(double latitude, double longitude)
      위도와 경도로 좌표를 생성합니다.
      LatLng​(android.location.Location location)
      안드로이드의 Location 객체로부터 좌표를 생성합니다.
    • Field Detail

      • INVALID

        @NonNull
        public static final LatLng INVALID
        유효하지 않은(isValid()false인) 좌표를 나타내는 상수.
      • MINIMUM_LATITUDE

        public static final double MINIMUM_LATITUDE
        최소 위도. 도 단위.
        See Also:
        Constant Field Values
      • MAXIMUM_LATITUDE

        public static final double MAXIMUM_LATITUDE
        최대 위도. 도 단위.
        See Also:
        Constant Field Values
      • MINIMUM_LONGITUDE

        public static final double MINIMUM_LONGITUDE
        최소 경도. 도 단위.
        See Also:
        Constant Field Values
      • MAXIMUM_LONGITUDE

        public static final double MAXIMUM_LONGITUDE
        최대 경도. 도 단위.
        See Also:
        Constant Field Values
      • COVERAGE

        public static LatLngBounds COVERAGE
        위경도 좌표로 나타낼 수 있는 커버리지 영역. 전 세계.
      • latitude

        public final double latitude
        위도. 도 단위.
      • longitude

        public final double longitude
        경도. 도 단위.
      • CREATOR

        public static final android.os.Parcelable.Creator<LatLng> CREATOR
    • Constructor Detail

      • LatLng

        public LatLng​(double latitude,
                      double longitude)
        위도와 경도로 좌표를 생성합니다.
        Parameters:
        latitude - 위도. 도 단위.
        longitude - 경도. 도 단위.
      • LatLng

        public LatLng​(@NonNull
                      android.location.Location location)
        안드로이드의 Location 객체로부터 좌표를 생성합니다.
        Parameters:
        location - 안드로이드 Location 객체.
    • Method Detail

      • isValid

        public boolean isValid()
        좌표가 유효한지 여부를 반환합니다. latitude 또는 longitudeDouble.NaN이거나 무한대일 경우 올바르지 않은 것으로 간주됩니다.
        Specified by:
        isValid in interface Coord
        Returns:
        유효할 경우 true, 그렇지 않을 경우 false.
      • isWithinCoverage

        public boolean isWithinCoverage()
        좌표가 좌표계의 커버리지 내에 포함되는지 여부를 반환합니다. 커버리지를 벗어날 경우 좌표 연산의 정확도가 보장되지 않습니다.
        Specified by:
        isWithinCoverage in interface Coord
        Returns:
        커버리지 내일 경우 true, 그렇지 않을 경우 false.
      • wrap

        @CheckResult
        @NonNull
        public LatLng wrap()
        이 좌표의 longitude를 [MINIMUM_LONGITUDE, MAXIMUM_LONGITUDE] 범위로 래핑한 좌표를 반환합니다. longitude가 이미 해당 범위에 속해 있을 경우 새로운 객체가 만들어지지 않고 이 객체가 반환됩니다.
        Returns:
        경도가 래핑된 좌표 객체.
      • distanceTo

        public double distanceTo​(@NonNull
                                 LatLng other)
        다른 좌표와의 거리를 반환합니다.
        Parameters:
        other - 거리를 잴 다른 좌표.
        Returns:
        좌표 간의 거리. 미터 단위.
      • offset

        @CheckResult
        @NonNull
        public LatLng offset​(double northMeter,
                             double eastMeter)
        이 좌표로부터 북쪽으로 northMeter미터, 동쪽으로 eastMeter미터만큼 떨어진 좌표를 반환합니다.
        Parameters:
        northMeter - 북쪽 방향 거리. 미터 단위.
        eastMeter - 동쪽 방향 거리. 미터 단위.
        Returns:
        좌표.
      • toLatLng

        @NonNull
        public LatLng toLatLng()
        좌표를 위경도 좌표로 변환합니다.
        Specified by:
        toLatLng in interface Coord
        Returns:
        변환된 위경도 좌표.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(android.os.Parcel dest,
                                  int flags)
        Specified by:
        writeToParcel in interface android.os.Parcelable