58 lines
2.2 KiB
Java
58 lines
2.2 KiB
Java
package com.google.android.gms.maps.model;
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import com.google.android.gms.common.internal.ReflectedParcelable;
|
|
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
|
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class LatLng extends AbstractSafeParcelable implements ReflectedParcelable {
|
|
public static final Parcelable.Creator<LatLng> CREATOR = new zzf();
|
|
public final double latitude;
|
|
public final double longitude;
|
|
|
|
public LatLng(double d, double d2) {
|
|
this.longitude = (-180.0d > d2 || d2 >= 180.0d) ? ((((d2 - 180.0d) % 360.0d) + 360.0d) % 360.0d) - 180.0d : d2;
|
|
this.latitude = Math.max(-90.0d, Math.min(90.0d, d));
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
int beginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
|
SafeParcelWriter.writeDouble(parcel, 2, this.latitude);
|
|
SafeParcelWriter.writeDouble(parcel, 3, this.longitude);
|
|
SafeParcelWriter.finishObjectHeader(parcel, beginObjectHeader);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
long doubleToLongBits = Double.doubleToLongBits(this.latitude);
|
|
int i = (int) (doubleToLongBits ^ (doubleToLongBits >>> 32));
|
|
long doubleToLongBits2 = Double.doubleToLongBits(this.longitude);
|
|
return ((i + 31) * 31) + ((int) ((doubleToLongBits2 >>> 32) ^ doubleToLongBits2));
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof LatLng)) {
|
|
return false;
|
|
}
|
|
LatLng latLng = (LatLng) obj;
|
|
return Double.doubleToLongBits(this.latitude) == Double.doubleToLongBits(latLng.latitude) && Double.doubleToLongBits(this.longitude) == Double.doubleToLongBits(latLng.longitude);
|
|
}
|
|
|
|
public final String toString() {
|
|
double d = this.latitude;
|
|
double d2 = this.longitude;
|
|
StringBuilder sb = new StringBuilder(60);
|
|
sb.append("lat/lng: (");
|
|
sb.append(d);
|
|
sb.append(",");
|
|
sb.append(d2);
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
}
|