Don't show destination arrow

This commit is contained in:
PavelRatushny 2017-10-12 17:45:49 +03:00
parent 42b12a440a
commit ee37e9c390
3 changed files with 1 additions and 33 deletions

View file

@ -1280,13 +1280,6 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference("map_online_data", false).makeGlobal(); public final CommonPreference<Boolean> MAP_ONLINE_DATA = new BooleanPreference("map_online_data", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> SHOW_DESTINATION_ARROW = new BooleanPreference("show_destination_arrow", false).makeProfile();
{
SHOW_DESTINATION_ARROW.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
}
public final CommonPreference<String> CONTOUR_LINES_ZOOM = new StringPreference("contour_lines_zoom", null).makeGlobal().cache(); public final CommonPreference<String> CONTOUR_LINES_ZOOM = new StringPreference("contour_lines_zoom", null).makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name

View file

@ -38,7 +38,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
private Bitmap mStartPoint; private Bitmap mStartPoint;
private Bitmap mTargetPoint; private Bitmap mTargetPoint;
private Bitmap mIntermediatePoint; private Bitmap mIntermediatePoint;
private Bitmap mArrowToDestination;
private Paint mTextPaint; private Paint mTextPaint;
@ -68,7 +67,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
mStartPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_start_point); mStartPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_start_point);
mTargetPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_target_point); mTargetPoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_target_point);
mIntermediatePoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_intermediate_point); mIntermediatePoint = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_intermediate_point);
mArrowToDestination = BitmapFactory.decodeResource(mView.getResources(), R.drawable.map_arrow_to_destination);
} }
@Override @Override
@ -126,27 +124,6 @@ public class PointNavigationLayer extends OsmandMapLayer implements
canvas.rotate(tb.getRotate(), locationX, locationY); canvas.rotate(tb.getRotate(), locationX, locationY);
} }
Iterator<TargetPoint> it = targetPoints.getIntermediatePoints().iterator();
if (it.hasNext()) {
pointToNavigate = it.next();
}
if (pointToNavigate != null && !isLocationVisible(tb, pointToNavigate)) {
boolean show = !mView.getApplication().getRoutingHelper().isRouteCalculated();
if (mView.getSettings().SHOW_DESTINATION_ARROW.isSet()) {
show = mView.getSettings().SHOW_DESTINATION_ARROW.get();
}
if (show) {
net.osmand.Location.distanceBetween(mView.getLatitude(), mView.getLongitude(),
pointToNavigate.getLatitude(), pointToNavigate.getLongitude(), mCalculations);
float bearing = mCalculations[1] - 90;
float radiusBearing = DIST_TO_SHOW * tb.getDensity();
final QuadPoint cp = tb.getCenterPixelPoint();
canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity());
canvas.drawBitmap(mArrowToDestination, cp.x, cp.y, mBitmapPaint);
}
}
} }
private float getPointX(RotatedTileBox tileBox, TargetPoint point) { private float getPointX(RotatedTileBox tileBox, TargetPoint point) {

View file

@ -311,8 +311,7 @@ public class MapWidgetRegistry {
} }
private void resetDefaultAppearance(ApplicationMode appMode) { private void resetDefaultAppearance(ApplicationMode appMode) {
// settings.SHOW_RULER.resetToDefault(); // settings.SHOW_RULER.resetToDefault();
settings.SHOW_DESTINATION_ARROW.resetToDefault();
settings.TRANSPARENT_MAP_THEME.resetToDefault(); settings.TRANSPARENT_MAP_THEME.resetToDefault();
settings.SHOW_STREET_NAME.resetToDefault(); settings.SHOW_STREET_NAME.resetToDefault();
settings.CENTER_POSITION_ON_MAP.resetToDefault(); settings.CENTER_POSITION_ON_MAP.resetToDefault();
@ -320,7 +319,6 @@ public class MapWidgetRegistry {
} }
public void addControlsAppearance(final MapActivity map, final ContextMenuAdapter cm, ApplicationMode mode) { public void addControlsAppearance(final MapActivity map, final ContextMenuAdapter cm, ApplicationMode mode) {
addControlId(map, cm, R.string.map_widget_show_destination_arrow, settings.SHOW_DESTINATION_ARROW);
addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME); addControlId(map, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP); addControlId(map, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
if (mode != ApplicationMode.DEFAULT) { if (mode != ApplicationMode.DEFAULT) {