Rename angle to bearing
This commit is contained in:
@@ -213,9 +213,7 @@ public class MapView extends SurfaceView {
|
||||
}
|
||||
|
||||
public double getDirection() {
|
||||
double direction = mNativeMapView.getAngle();
|
||||
|
||||
direction *= 180 / Math.PI;
|
||||
double direction = -mNativeMapView.getBearing();
|
||||
|
||||
while (direction > 360)
|
||||
direction -= 360;
|
||||
@@ -232,9 +230,7 @@ public class MapView extends SurfaceView {
|
||||
public void setDirection(double direction, boolean animated) {
|
||||
double duration = animated ? 0.3 : 0.0;
|
||||
|
||||
direction *= Math.PI / 180;
|
||||
|
||||
mNativeMapView.setAngle(direction, duration);
|
||||
mNativeMapView.setBearing(-direction, duration);
|
||||
}
|
||||
|
||||
public void resetPosition() {
|
||||
@@ -362,7 +358,7 @@ public class MapView extends SurfaceView {
|
||||
if (savedInstanceState != null) {
|
||||
lonlat = (LonLat) savedInstanceState
|
||||
.getParcelable(STATE_CENTER_COORDINATE);
|
||||
angle = savedInstanceState.getDouble(STATE_CENTER_DIRECTION);
|
||||
bearing = savedInstanceState.getDouble(STATE_CENTER_DIRECTION);
|
||||
zoom = savedInstanceState.getDouble(STATE_ZOOM_LEVEL);
|
||||
setCenterCoordinate((LonLat) savedInstanceState
|
||||
.getParcelable(STATE_CENTER_COORDINATE));
|
||||
@@ -418,7 +414,7 @@ public class MapView extends SurfaceView {
|
||||
public void onPause() {
|
||||
Log.v(TAG, "onPause");
|
||||
lonlat = mNativeMapView.getLonLat();
|
||||
angle = mNativeMapView.getAngle();
|
||||
bearing = mNativeMapView.getBearing();
|
||||
zoom = mNativeMapView.getZoom();
|
||||
mNativeMapView.stop();
|
||||
}
|
||||
@@ -429,14 +425,14 @@ public class MapView extends SurfaceView {
|
||||
// TODO need to fix this in Map C++ code
|
||||
// Seems map state gets reset when we start()
|
||||
private LonLat lonlat;
|
||||
private double angle, zoom;
|
||||
private double bearing, zoom;
|
||||
|
||||
public void onResume() {
|
||||
Log.v(TAG, "onResume");
|
||||
mNativeMapView.start();
|
||||
if (lonlat != null) {
|
||||
mNativeMapView.setLonLat(lonlat);
|
||||
mNativeMapView.setAngle(angle);
|
||||
mNativeMapView.setBearing(bearing);
|
||||
mNativeMapView.setZoom(zoom);
|
||||
}
|
||||
}
|
||||
@@ -461,7 +457,7 @@ public class MapView extends SurfaceView {
|
||||
mNativeMapView.createSurface(holder.getSurface());
|
||||
if (lonlat != null) {
|
||||
mNativeMapView.setLonLat(lonlat);
|
||||
mNativeMapView.setAngle(angle);
|
||||
mNativeMapView.setBearing(bearing);
|
||||
mNativeMapView.setZoom(zoom);
|
||||
}
|
||||
}
|
||||
@@ -834,10 +830,10 @@ public class MapView extends SurfaceView {
|
||||
mNativeMapView.cancelTransitions();
|
||||
|
||||
// Rotate the map
|
||||
double angle = mNativeMapView.getAngle();
|
||||
angle -= detector.getRotationDegreesDelta() * Math.PI / 180.0;
|
||||
Log.d("rotate", "rotate to " + angle);
|
||||
mNativeMapView.setAngle(angle, detector.getFocusX(),
|
||||
double bearing = mNativeMapView.getBearing();
|
||||
bearing += detector.getRotationDegreesDelta() * Math.PI / 180.0;
|
||||
Log.d("rotate", "rotate to " + bearing);
|
||||
mNativeMapView.setBearing(bearing, detector.getFocusX(),
|
||||
detector.getFocusY());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -295,20 +295,20 @@ class NativeMapView {
|
||||
nativeRotateBy(mNativeMapViewPtr, sx, sy, ex, ey, duration);
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
setAngle(angle, 0.0);
|
||||
public void setBearing(double degrees) {
|
||||
setBearing(degrees, 0.0);
|
||||
}
|
||||
|
||||
public void setAngle(double angle, double duration) {
|
||||
nativeSetAngle(mNativeMapViewPtr, angle, duration);
|
||||
public void setBearing(double degrees, double duration) {
|
||||
nativeSetBearing(mNativeMapViewPtr, degrees, duration);
|
||||
}
|
||||
|
||||
public void setAngle(double angle, double cx, double cy) {
|
||||
nativeSetAngle(mNativeMapViewPtr, angle, cx, cy);
|
||||
public void setBearing(double degrees, double cx, double cy) {
|
||||
nativeSetBearing(mNativeMapViewPtr, degrees, cx, cy);
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return nativeGetAngle(mNativeMapViewPtr);
|
||||
public double getBearing() {
|
||||
return nativeGetBearing(mNativeMapViewPtr);
|
||||
}
|
||||
|
||||
public void resetNorth() {
|
||||
@@ -452,13 +452,13 @@ class NativeMapView {
|
||||
private native void nativeRotateBy(long nativeMapViewPtr, double sx,
|
||||
double sy, double ex, double ey, double duration);
|
||||
|
||||
private native void nativeSetAngle(long nativeMapViewPtr, double angle,
|
||||
private native void nativeSetBearing(long nativeMapViewPtr, double degrees,
|
||||
double duration);
|
||||
|
||||
private native void nativeSetAngle(long nativeMapViewPtr, double angle,
|
||||
private native void nativeSetBearing(long nativeMapViewPtr, double degrees,
|
||||
double cx, double cy);
|
||||
|
||||
private native double nativeGetAngle(long nativeMapViewPtr);
|
||||
private native double nativeGetBearing(long nativeMapViewPtr);
|
||||
|
||||
private native void nativeResetNorth(long nativeMapViewPtr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user