diff --git a/OsmAnd-api/src/net/osmand/aidlapi/map/SetMapLocationParams.java b/OsmAnd-api/src/net/osmand/aidlapi/map/SetMapLocationParams.java index 9da5ee83f0..d441682da5 100644 --- a/OsmAnd-api/src/net/osmand/aidlapi/map/SetMapLocationParams.java +++ b/OsmAnd-api/src/net/osmand/aidlapi/map/SetMapLocationParams.java @@ -10,12 +10,14 @@ public class SetMapLocationParams extends AidlParams { private double latitude; private double longitude; private int zoom; + private float rotation; private boolean animated; - public SetMapLocationParams(double latitude, double longitude, int zoom, boolean animated) { + public SetMapLocationParams(double latitude, double longitude, int zoom, float rotation, boolean animated) { this.latitude = latitude; this.longitude = longitude; this.zoom = zoom; + this.rotation = rotation; this.animated = animated; } @@ -47,6 +49,10 @@ public class SetMapLocationParams extends AidlParams { return zoom; } + public float getRotation() { + return rotation; + } + public boolean isAnimated() { return animated; } @@ -56,6 +62,7 @@ public class SetMapLocationParams extends AidlParams { bundle.putDouble("latitude", latitude); bundle.putDouble("longitude", longitude); bundle.putInt("zoom", zoom); + bundle.putFloat("rotation", rotation); bundle.putBoolean("animated", animated); } @@ -64,6 +71,7 @@ public class SetMapLocationParams extends AidlParams { latitude = bundle.getDouble("latitude"); longitude = bundle.getDouble("longitude"); zoom = bundle.getInt("zoom"); + rotation = bundle.getFloat("rotation"); animated = bundle.getBoolean("animated"); } } \ No newline at end of file diff --git a/OsmAnd-telegram/src/net/osmand/aidl/map/SetMapLocationParams.java b/OsmAnd-telegram/src/net/osmand/aidl/map/SetMapLocationParams.java index 929c817d9d..7feea74d20 100644 --- a/OsmAnd-telegram/src/net/osmand/aidl/map/SetMapLocationParams.java +++ b/OsmAnd-telegram/src/net/osmand/aidl/map/SetMapLocationParams.java @@ -8,12 +8,15 @@ public class SetMapLocationParams implements Parcelable { private double latitude; private double longitude; private int zoom; - private boolean animated; + private float rotation; - public SetMapLocationParams(double latitude, double longitude, int zoom, boolean animated) { + private boolean animated; + + public SetMapLocationParams(double latitude, double longitude, int zoom, float rotation, boolean animated) { this.latitude = latitude; this.longitude = longitude; this.zoom = zoom; + this.rotation = rotation; this.animated = animated; } @@ -44,6 +47,10 @@ public class SetMapLocationParams implements Parcelable { return zoom; } + public float getRotation() { + return rotation; + } + public boolean isAnimated() { return animated; } @@ -53,6 +60,7 @@ public class SetMapLocationParams implements Parcelable { out.writeDouble(longitude); out.writeInt(zoom); out.writeByte((byte) (animated ? 1 : 0)); + out.writeFloat(rotation); } private void readFromParcel(Parcel in) { @@ -60,6 +68,7 @@ public class SetMapLocationParams implements Parcelable { longitude = in.readDouble(); zoom = in.readInt(); animated = in.readByte() != 0; + rotation = in.readFloat(); } public int describeContents() { diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 96686c9956..583915f081 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -138,6 +138,7 @@ public class OsmandAidlApi { private static final String AIDL_LATITUDE = "aidl_latitude"; private static final String AIDL_LONGITUDE = "aidl_longitude"; private static final String AIDL_ZOOM = "aidl_zoom"; + private static final String AIDL_ROTATION = "aidl_rotation"; private static final String AIDL_ANIMATED = "aidl_animated"; private static final String AIDL_START_NAME = "aidl_start_name"; @@ -292,6 +293,7 @@ public class OsmandAidlApi { double lon = intent.getDoubleExtra(AIDL_LONGITUDE, Double.NaN); int zoom = intent.getIntExtra(AIDL_ZOOM, 0); boolean animated = intent.getBooleanExtra(AIDL_ANIMATED, false); + float rotation = intent.getFloatExtra(AIDL_ROTATION, Float.NaN); if (!Double.isNaN(lat) && !Double.isNaN(lon)) { OsmandMapTileView mapView = mapActivity.getMapView(); if (zoom == 0) { @@ -300,6 +302,9 @@ public class OsmandAidlApi { zoom = zoom > mapView.getMaxZoom() ? mapView.getMaxZoom() : zoom; zoom = zoom < mapView.getMinZoom() ? mapView.getMinZoom() : zoom; } + if(!Float.isNaN(rotation)) { + mapView.setRotate(rotation, false); + } if (animated) { mapView.getAnimatedDraggingThread().startMoving(lat, lon, zoom, true); } else { @@ -1548,12 +1553,13 @@ public class OsmandAidlApi { return false; } - boolean setMapLocation(double latitude, double longitude, int zoom, boolean animated) { + boolean setMapLocation(double latitude, double longitude, int zoom, float rotation, boolean animated) { Intent intent = new Intent(); intent.setAction(AIDL_SET_MAP_LOCATION); intent.putExtra(AIDL_LATITUDE, latitude); intent.putExtra(AIDL_LONGITUDE, longitude); intent.putExtra(AIDL_ZOOM, zoom); + intent.putExtra(AIDL_ROTATION, rotation); intent.putExtra(AIDL_ANIMATED, animated); app.sendBroadcast(intent); return true; diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java index 8763156abe..59e998cf56 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java @@ -597,7 +597,7 @@ public class OsmandAidlService extends Service implements AidlCallbackListener { if (params != null) { OsmandAidlApi api = getApi("setMapLocation"); return api != null && api.setMapLocation(params.getLatitude(), params.getLongitude(), - params.getZoom(), params.isAnimated()); + params.getZoom(), params.getRotation(), params.isAnimated()); } return false; } catch (Exception e) { diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java index 1953e185fd..413eb1a68c 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlServiceV2.java @@ -597,7 +597,7 @@ public class OsmandAidlServiceV2 extends Service implements AidlCallbackListener if (params != null) { OsmandAidlApi api = getApi("setMapLocation"); return api != null && api.setMapLocation(params.getLatitude(), params.getLongitude(), - params.getZoom(), params.isAnimated()); + params.getZoom(), params.getRotation(), params.isAnimated()); } return false; } catch (Exception e) { diff --git a/OsmAnd/src/net/osmand/aidl/map/SetMapLocationParams.java b/OsmAnd/src/net/osmand/aidl/map/SetMapLocationParams.java index 929c817d9d..788ac784c7 100644 --- a/OsmAnd/src/net/osmand/aidl/map/SetMapLocationParams.java +++ b/OsmAnd/src/net/osmand/aidl/map/SetMapLocationParams.java @@ -8,12 +8,15 @@ public class SetMapLocationParams implements Parcelable { private double latitude; private double longitude; private int zoom; + private float rotation; private boolean animated; - public SetMapLocationParams(double latitude, double longitude, int zoom, boolean animated) { + + public SetMapLocationParams(double latitude, double longitude, int zoom, float rotation, boolean animated) { this.latitude = latitude; this.longitude = longitude; this.zoom = zoom; + this.rotation = rotation; this.animated = animated; } @@ -44,6 +47,10 @@ public class SetMapLocationParams implements Parcelable { return zoom; } + public float getRotation() { + return rotation; + } + public boolean isAnimated() { return animated; } @@ -53,6 +60,7 @@ public class SetMapLocationParams implements Parcelable { out.writeDouble(longitude); out.writeInt(zoom); out.writeByte((byte) (animated ? 1 : 0)); + out.writeFloat(rotation); } private void readFromParcel(Parcel in) { @@ -60,6 +68,7 @@ public class SetMapLocationParams implements Parcelable { longitude = in.readDouble(); zoom = in.readInt(); animated = in.readByte() != 0; + rotation = in.readFloat(); } public int describeContents() {