Fix drawing markers

This commit is contained in:
PavelRatushny 2017-11-21 11:07:51 +02:00
parent 5794330cb4
commit 964b85ebe6

View file

@ -365,33 +365,19 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
if (contextMenuLayer.getMoveableObject() instanceof MapMarker) {
MapMarker objectInMotion = (MapMarker) contextMenuLayer.getMoveableObject();
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
if (isSynced(objectInMotion)) {
drawSyncedPoint(canvas, pf, objectInMotion);
} else {
drawPoint(canvas, tileBox, pf, objectInMotion);
}
Bitmap bitmap = getMapMarkerBitmap(objectInMotion.colorIndex);
int marginX = bitmap.getWidth() / 6;
int marginY = bitmap.getHeight();
float locationX = pf.x;
float locationY = pf.y;
canvas.rotate(-tileBox.getRotate(), locationX, locationY);
canvas.drawBitmap(bitmap, locationX - marginX, locationY - marginY, bitmapPaint);
}
}
private void drawSyncedPoint(Canvas canvas, PointF pf, MapMarker marker) {
FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(),
MapMarker.getColorId(marker.colorIndex), true);
fid.drawBitmapInCenter(canvas, pf.x, pf.y);
}
private void drawPoint(Canvas canvas, RotatedTileBox tileBox, PointF pf, MapMarker marker) {
Bitmap bitmap = getMapMarkerBitmap(marker.colorIndex);
int marginX = bitmap.getWidth() / 6;
int marginY = bitmap.getHeight();
float locationX = pf.x;
float locationY = pf.y;
canvas.rotate(-tileBox.getRotate(), locationX, locationY);
canvas.drawBitmap(bitmap, locationX - marginX, locationY - marginY, bitmapPaint);
}
private boolean isSynced(@NonNull MapMarker marker) {
return marker.groupKey != null;
return marker.wptPt != null || marker.favouritePoint != null;
}
private boolean isInMotion(@NonNull MapMarker marker) {