Fix AND-451 3/4

This commit is contained in:
Alexey Kulish 2016-04-08 19:07:12 +03:00
parent c749bc1455
commit 19146b21eb
2 changed files with 33 additions and 20 deletions

View file

@ -21,6 +21,7 @@ import net.osmand.data.RotatedTileBox;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -263,26 +264,34 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
} }
} }
boolean show = useFingerLocation && map.getMyApplication().getSettings().SHOW_DESTINATION_ARROW.get(); boolean show = useFingerLocation ||
if (show && fingerLocation != null) { (map.getMyApplication().getSettings().MAP_MARKERS_MODE.get() == OsmandSettings.MapMarkersMode.WIDGETS
List<MapMarker> sortedMapMarkers = markersHelper.getSortedMapMarkers(); && map.getMyApplication().getSettings().SHOW_DESTINATION_ARROW.get());
int i = 0; if (show) {
for (MapMarker marker : sortedMapMarkers) { LatLon loc = fingerLocation;
if (!isLocationVisible(tb, marker)) { if (!useFingerLocation) {
canvas.save(); loc = tb.getCenterLatLon();
net.osmand.Location.distanceBetween(fingerLocation.getLatitude(), fingerLocation.getLongitude(), }
marker.getLatitude(), marker.getLongitude(), calculations); if (loc != null) {
float bearing = calculations[1] - 90; List<MapMarker> sortedMapMarkers = markersHelper.getSortedMapMarkers();
float radiusBearing = DIST_TO_SHOW * tb.getDensity(); int i = 0;
final QuadPoint cp = tb.getCenterPixelPoint(); for (MapMarker marker : sortedMapMarkers) {
canvas.rotate(bearing, cp.x, cp.y); if (!isLocationVisible(tb, marker)) {
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity()); canvas.save();
canvas.drawBitmap(arrowToDestination, cp.x, cp.y, getMarkerDestPaint(marker.colorIndex)); net.osmand.Location.distanceBetween(loc.getLatitude(), loc.getLongitude(),
canvas.restore(); marker.getLatitude(), marker.getLongitude(), calculations);
} float bearing = calculations[1] - 90;
i++; float radiusBearing = DIST_TO_SHOW * tb.getDensity();
if (i > 1) { final QuadPoint cp = tb.getCenterPixelPoint();
break; canvas.rotate(bearing, cp.x, cp.y);
canvas.translate(-24 * tb.getDensity() + radiusBearing, -22 * tb.getDensity());
canvas.drawBitmap(arrowToDestination, cp.x, cp.y, getMarkerDestPaint(marker.colorIndex));
canvas.restore();
}
i++;
if (i > 1) {
break;
}
} }
} }
} }

View file

@ -234,6 +234,10 @@ public class MapMarkersWidgetsFactory {
Location.distanceBetween(marker.getLatitude(), marker.getLongitude(), loc.getLatitude(), loc.getLongitude(), mes); Location.distanceBetween(marker.getLatitude(), marker.getLongitude(), loc.getLatitude(), loc.getLongitude(), mes);
} }
if (customLocation) {
heading = 0f;
}
boolean newImage = false; boolean newImage = false;
DirectionDrawable dd; DirectionDrawable dd;
if (!(arrowImg.getDrawable() instanceof DirectionDrawable)) { if (!(arrowImg.getDrawable() instanceof DirectionDrawable)) {