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






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;
/* w ww .  j a  va2s  .c  om*/
import android.os.Parcel;

/**
 * Stores latitude, longitude, and altitude information for a coordinate.
 */
public class LatLngAlt extends LatLng {

    /**
     * Stores the altitude in meters.
     */
    private float mAltitude;

    public LatLngAlt(float latitude, float longitude, float altitude) {
        super(latitude, longitude);
        mAltitude = altitude;
    }

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

    /**
     * @return the altitude in meters
     */
    public float getAltitude() {
        return mAltitude;
    }

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

        LatLngAlt latLngAlt = (LatLngAlt) o;

        return Float.compare(latLngAlt.mAltitude, mAltitude) == 0;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (mAltitude != +0.0f ? Float.floatToIntBits(mAltitude) : 0);
        return result;
    }

    @Override
    public String toString() {
        return "LatLngAlt{" +
                "mAltitude=" + mAltitude +
                '}';
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeFloat(mAltitude);
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mAltitude = in.readFloat();
    }

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

    public static final Creator<LatLngAlt> CREATOR = new Creator<LatLngAlt>() {

        @Override
        public LatLngAlt createFromParcel(Parcel source) {
            return new LatLngAlt(source);
        }

        @Override
        public LatLngAlt[] newArray(int size) {
            return new LatLngAlt[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