Android Open Source - 3DR-Services-Library Lat Lng






From Project

Back to project page 3DR-Services-Library.

License

The source code is released under:

Apache License

If you think the Android project 3DR-Services-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ox3dr.services.android.lib.coordinate;
//from  w  w w.ja  va  2  s.co  m
import android.graphics.PointF;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Stores latitude and longitude in degrees.
 */
public class LatLng implements Parcelable {

    /**
     * Stores latitude, and longitude in degrees
     */
    private PointF mLatLng;

    protected LatLng(){}

    public LatLng(float latitude, float longitude){
        mLatLng = new PointF(latitude, longitude);
    }

    public LatLng(LatLng copy){
        this(copy.getLatitude(), copy.getLongitude());
    }

    /**
     * @return the latitude in degrees
     */
    public float getLatitude(){
        return mLatLng.x;
    }

    /**
     * @return the longitude in degrees
     */
    public float getLongitude(){
        return mLatLng.y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof LatLng)) return false;

        LatLng latLng = (LatLng) o;

        return mLatLng.equals(latLng.mLatLng);
    }

    @Override
    public int hashCode() {
        return mLatLng.hashCode();
    }

    @Override
    public String toString() {
        return "LatLng{" +
                "mLatLng=" + mLatLng +
                '}';
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.mLatLng, 0);
    }

    protected void readFromParcel(Parcel in){
        this.mLatLng = in.readParcelable(PointF.class.getClassLoader());
    }

    protected LatLng(Parcel in) {
        readFromParcel(in);
    }

    public static final Parcelable.Creator<LatLng> CREATOR = new Parcelable.Creator<LatLng>() {
        public LatLng createFromParcel(Parcel source) {
            return new LatLng(source);
        }

        public LatLng[] newArray(int size) {
            return new LatLng[size];
        }
    };
}




Java Source Code List

com.ox3dr.services.android.lib.ApplicationTest.java
com.ox3dr.services.android.lib.coordinate.LatLngAlt.java
com.ox3dr.services.android.lib.coordinate.LatLng.java
com.ox3dr.services.android.lib.drone.connection.ConnectionParameter.java
com.ox3dr.services.android.lib.drone.connection.ConnectionResult.java
com.ox3dr.services.android.lib.drone.connection.ConnectionType.java
com.ox3dr.services.android.lib.drone.event.Event.java
com.ox3dr.services.android.lib.drone.event.Extra.java
com.ox3dr.services.android.lib.drone.property.Altitude.java
com.ox3dr.services.android.lib.drone.property.Attitude.java
com.ox3dr.services.android.lib.drone.property.Battery.java
com.ox3dr.services.android.lib.drone.property.Gps.java
com.ox3dr.services.android.lib.drone.property.Home.java
com.ox3dr.services.android.lib.drone.property.MissionItemMessage.java
com.ox3dr.services.android.lib.drone.property.Mission.java
com.ox3dr.services.android.lib.drone.property.Parameter.java
com.ox3dr.services.android.lib.drone.property.Parameters.java
com.ox3dr.services.android.lib.drone.property.Speed.java
com.ox3dr.services.android.lib.drone.property.State.java
com.ox3dr.services.android.lib.drone.property.Type.java
com.ox3dr.services.android.lib.drone.property.VehicleMode.java