-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added get_route api function & aidl get_position #9304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 11 commits
f47eaf8
d16d530
b899b04
34261ca
685e370
4a279ed
a219ef2
1545783
93c5901
ea341fa
04c7327
9c75003
d5d8f1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package net.osmand.aidlapi; | ||
|
|
||
| import net.osmand.aidlapi.map.ALatLon; | ||
| import net.osmand.aidlapi.map.APosition; | ||
| import net.osmand.aidlapi.map.SetMapLocationParams; | ||
|
|
||
| import net.osmand.aidlapi.favorite.group.AFavoriteGroup; | ||
|
|
@@ -860,4 +861,34 @@ interface IOsmAndAidlInterface { | |
| * @params keyEventList (List<Integer>) - list of requested key events | ||
| */ | ||
| long registerForKeyEvents(in AKeyEventsParams params, IOsmAndAidlCallback callback); | ||
| } | ||
|
|
||
| /** | ||
| * Method to get position of various objects | ||
| * | ||
| * @params positionType (int) - type of position to get | ||
| */ | ||
| boolean getPosition(in int positionType, out APosition position); | ||
|
|
||
| /** | ||
| * Method to get index of the current route segment | ||
| */ | ||
| int getCurrentRouteSegmentIndex(); | ||
|
|
||
| /** | ||
| * Method to get creation time of current route | ||
| * | ||
| */ | ||
| long getRouteCreationTime(); | ||
|
|
||
| /** | ||
| * Method to get current route points | ||
| * | ||
| */ | ||
| boolean getRoutePoints(out List<ALatLon> route); | ||
|
|
||
| /** | ||
| * Method to get application mode | ||
| * | ||
| */ | ||
| String getApplicationMode(); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be refactored into 3 differnet methods:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in latest commit |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| parcelable APosition; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| import android.os.Parcel; | ||
| import android.os.Parcelable; | ||
|
|
||
| public class APosition implements Parcelable { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in latest commit |
||
|
|
||
| public double getLatitude() { | ||
| return latitude; | ||
| } | ||
|
|
||
| public void setLatitude(double latitude) { | ||
| this.latitude = latitude; | ||
| } | ||
|
|
||
| public double getLongitude() { | ||
| return longitude; | ||
| } | ||
|
|
||
| public void setLongitude(double longitude) { | ||
| this.longitude = longitude; | ||
| } | ||
|
|
||
| public double getAltitude() { | ||
| return altitude; | ||
| } | ||
|
|
||
| public void setAltitude(double altitude) { | ||
| this.altitude = altitude; | ||
| } | ||
|
|
||
| public double getSpeed() { | ||
| return speed; | ||
| } | ||
|
|
||
| public void setSpeed(double speed) { | ||
| this.speed = speed; | ||
| } | ||
|
|
||
| public double getBearing() { | ||
| return bearing; | ||
| } | ||
|
|
||
| public void setBearing(double bearing) { | ||
| this.bearing = bearing; | ||
| } | ||
|
|
||
| private double latitude; | ||
| private double longitude; | ||
| private double altitude; | ||
| private double speed; | ||
| private double bearing; | ||
|
|
||
| public APosition(double latitude, double longitude, double altitude, double speed, double bearing) { | ||
| this.latitude = latitude; | ||
| this.longitude = longitude; | ||
| this.altitude = altitude; | ||
| this.speed = speed; | ||
| this.bearing = bearing; | ||
| } | ||
|
|
||
| public APosition(Parcel in) { | ||
| readFromParcel(in); | ||
| } | ||
|
|
||
| public static final Creator<APosition> CREATOR = new | ||
| Creator<APosition>() { | ||
| public APosition createFromParcel(Parcel in) { | ||
| return new APosition(in); | ||
| } | ||
|
|
||
| public APosition[] newArray(int size) { | ||
| return new APosition[size]; | ||
| } | ||
| }; | ||
|
|
||
| public APosition() { | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| final int prime = 31; | ||
| int result = 1; | ||
| int temp; | ||
| temp = (int)Math.floor(latitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(longitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(altitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(speed * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(bearing * 10000); | ||
| result = prime * result + temp; | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) | ||
| return true; | ||
| if (obj == null) | ||
| return false; | ||
| if (getClass() != obj.getClass()) | ||
| return false; | ||
|
|
||
| APosition other = (APosition) obj; | ||
| return Math.abs(latitude - other.latitude) < 0.00001 | ||
| && Math.abs(longitude - other.longitude) < 0.00001 | ||
| && Math.abs(altitude - other.altitude) < 1 | ||
| && Math.abs(speed - other.speed) < 1; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "Lat " + ((float)latitude) + " Lon " + ((float)longitude) + " Alt " + ((float)altitude); | ||
| } | ||
|
|
||
| public void writeToParcel(Parcel out, int flags) { | ||
| out.writeDouble(latitude); | ||
| out.writeDouble(longitude); | ||
| out.writeDouble(altitude); | ||
| out.writeDouble(speed); | ||
| out.writeDouble(bearing); | ||
| } | ||
|
|
||
| public void readFromParcel(Parcel in) { | ||
| latitude = in.readDouble(); | ||
| longitude = in.readDouble(); | ||
| altitude = in.readDouble(); | ||
| speed = in.readDouble(); | ||
| bearing = in.readDouble(); | ||
| } | ||
|
|
||
| public int describeContents() { | ||
| return 0; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New aidl methods must be added to the end of the file or following methods will be broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, acknowledged )