forked from osmandapp/OsmAnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aidl method stub to get location aidl output parameter as parcelable APosition constructor params order fixed Order of AIDL methods rearranged; Added getCurrentRouteSegmentIndex() & getRouteCreationTime(); get rid of duplicate class LatLonParcelable, use ALatLon instead; added getRoute() aidl api method; added getRoutePoints() aidl method getApplicationMode() aidl method added Refactored due to osmandapp#9304 (comment) && osmandapp#9304 (comment)
- Loading branch information
1 parent
bb2c72e
commit 6b0ffe6
Showing
24 changed files
with
1,458 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
OsmAnd-api/src/net/osmand/aidlapi/calculateroute/CalculatedRoute.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package net.osmand.aidlapi.calculateroute; | ||
|
||
parcelable CalculatedRoute; |
133 changes: 133 additions & 0 deletions
133
OsmAnd-api/src/net/osmand/aidlapi/calculateroute/CalculatedRoute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
package net.osmand.aidlapi.calculateroute; | ||
|
||
import android.os.Bundle; | ||
import android.os.Parcel; | ||
|
||
import net.osmand.aidlapi.AidlParams; | ||
import net.osmand.aidlapi.map.ALatLon; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class CalculatedRoute extends AidlParams { | ||
|
||
private boolean isRouteCalculated; | ||
|
||
private String appMode; | ||
|
||
private ArrayList<ALatLon> routePoints; | ||
private int routeDistance; | ||
|
||
private float routingTime; | ||
private long creationTime; | ||
|
||
private float calculationTime; | ||
|
||
public CalculatedRoute() { | ||
|
||
} | ||
|
||
public CalculatedRoute(boolean isRouteCalculated, String appMode, ArrayList<ALatLon> routePoints, int routeDistance, float routingTime, long creationTime, float calculationTime) { | ||
this.isRouteCalculated = isRouteCalculated; | ||
this.appMode = appMode; | ||
this.routePoints = routePoints; | ||
this.routeDistance = routeDistance; | ||
this.routingTime = routingTime; | ||
this.creationTime = creationTime; | ||
this.calculationTime = calculationTime; | ||
} | ||
|
||
protected CalculatedRoute(Parcel in) { | ||
readFromParcel(in); | ||
} | ||
|
||
public static final Creator<CalculatedRoute> CREATOR = new Creator<CalculatedRoute>() { | ||
@Override | ||
public CalculatedRoute createFromParcel(Parcel in) { | ||
return new CalculatedRoute(in); | ||
} | ||
|
||
@Override | ||
public CalculatedRoute[] newArray(int size) { | ||
return new CalculatedRoute[size]; | ||
} | ||
}; | ||
|
||
public boolean isRouteCalculated() { | ||
return isRouteCalculated; | ||
} | ||
|
||
public String getAppMode() { | ||
return appMode; | ||
} | ||
|
||
public ArrayList<ALatLon> getRoutePoints() { | ||
return routePoints; | ||
} | ||
|
||
public int getRouteDistance() { | ||
return routeDistance; | ||
} | ||
|
||
public float getRoutingTime() { | ||
return routingTime; | ||
} | ||
|
||
public long getCreationTime() { | ||
return creationTime; | ||
} | ||
|
||
public float getCalculationTime() { | ||
return calculationTime; | ||
} | ||
|
||
public void setRouteCalculated(boolean routeCalculated) { | ||
isRouteCalculated = routeCalculated; | ||
} | ||
|
||
public void setAppMode(String appMode) { | ||
this.appMode = appMode; | ||
} | ||
|
||
public void setRoutePoints(ArrayList<ALatLon> routePoints) { | ||
this.routePoints = routePoints; | ||
} | ||
|
||
public void setRouteDistance(int routeDistance) { | ||
this.routeDistance = routeDistance; | ||
} | ||
|
||
public void setRoutingTime(float routingTime) { | ||
this.routingTime = routingTime; | ||
} | ||
|
||
public void setCreationTime(long creationTime) { | ||
this.creationTime = creationTime; | ||
} | ||
|
||
public void setCalculationTime(float calculationTime) { | ||
this.calculationTime = calculationTime; | ||
} | ||
|
||
@Override | ||
protected void readFromBundle(Bundle bundle) { | ||
bundle.setClassLoader(ALatLon.class.getClassLoader()); | ||
isRouteCalculated = bundle.getBoolean("isRouteCalculated"); | ||
appMode = bundle.getString("appMode"); | ||
routePoints = bundle.getParcelableArrayList("routePoints"); | ||
routeDistance = bundle.getInt("routeDistance"); | ||
routingTime = bundle.getFloat("routingTime"); | ||
creationTime = bundle.getLong("creationTime"); | ||
calculationTime = bundle.getFloat("calculationTime"); | ||
} | ||
|
||
@Override | ||
protected void writeToBundle(Bundle bundle) { | ||
bundle.putBoolean("isRouteCalculated", isRouteCalculated); | ||
bundle.putString("appMode", appMode); | ||
bundle.putParcelableArrayList("routePoints", routePoints); | ||
bundle.putInt("routeDistance", routeDistance); | ||
bundle.putFloat("routingTime", routingTime); | ||
bundle.putLong("creationTime", creationTime); | ||
bundle.putFloat("calculationTime", calculationTime); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package net.osmand.aidlapi.map; | ||
|
||
parcelable ALocation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
package net.osmand.aidlapi.map; | ||
|
||
import android.os.Bundle; | ||
import android.os.Parcel; | ||
|
||
import net.osmand.aidlapi.AidlParams; | ||
|
||
public class ALocation extends AidlParams { | ||
|
||
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 ALocation(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 ALocation(Parcel in) { | ||
readFromParcel(in); | ||
} | ||
|
||
public static final Creator<ALocation> CREATOR = new | ||
Creator<ALocation>() { | ||
public ALocation createFromParcel(Parcel in) { | ||
return new ALocation(in); | ||
} | ||
|
||
public ALocation[] newArray(int size) { | ||
return new ALocation[size]; | ||
} | ||
}; | ||
|
||
public ALocation() { | ||
} | ||
|
||
@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; | ||
|
||
ALocation other = (ALocation) 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); | ||
} | ||
|
||
|
||
@Override | ||
protected void readFromBundle(Bundle bundle) { | ||
latitude = bundle.getDouble("latitude", latitude); | ||
longitude = bundle.getDouble("longitude", longitude); | ||
altitude = bundle.getDouble("altitude", altitude); | ||
speed = bundle.getDouble("speed", speed); | ||
bearing = bundle.getDouble("bearing", bearing); | ||
} | ||
|
||
@Override | ||
protected void writeToBundle(Bundle bundle) { | ||
bundle.putDouble("latitude", latitude); | ||
bundle.putDouble("longitude", longitude); | ||
bundle.putDouble("altitude", altitude); | ||
bundle.putDouble("speed", speed); | ||
bundle.putDouble("bearing", bearing); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package net.osmand.aidlapi.map; | ||
|
||
parcelable ALocationType; |
Oops, something went wrong.