Fix drawing markers
This commit is contained in:
parent
5794330cb4
commit
964b85ebe6
1 changed files with 8 additions and 22 deletions
|
@ -365,33 +365,19 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
if (contextMenuLayer.getMoveableObject() instanceof MapMarker) {
|
if (contextMenuLayer.getMoveableObject() instanceof MapMarker) {
|
||||||
MapMarker objectInMotion = (MapMarker) contextMenuLayer.getMoveableObject();
|
MapMarker objectInMotion = (MapMarker) contextMenuLayer.getMoveableObject();
|
||||||
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
|
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
|
||||||
if (isSynced(objectInMotion)) {
|
Bitmap bitmap = getMapMarkerBitmap(objectInMotion.colorIndex);
|
||||||
drawSyncedPoint(canvas, pf, objectInMotion);
|
|
||||||
} else {
|
|
||||||
drawPoint(canvas, tileBox, pf, objectInMotion);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 marginX = bitmap.getWidth() / 6;
|
||||||
int marginY = bitmap.getHeight();
|
int marginY = bitmap.getHeight();
|
||||||
float locationX = pf.x;
|
float locationX = pf.x;
|
||||||
float locationY = pf.y;
|
float locationY = pf.y;
|
||||||
canvas.rotate(-tileBox.getRotate(), locationX, locationY);
|
canvas.rotate(-tileBox.getRotate(), locationX, locationY);
|
||||||
canvas.drawBitmap(bitmap, locationX - marginX, locationY - marginY, bitmapPaint);
|
canvas.drawBitmap(bitmap, locationX - marginX, locationY - marginY, bitmapPaint);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSynced(@NonNull MapMarker marker) {
|
private boolean isSynced(@NonNull MapMarker marker) {
|
||||||
return marker.groupKey != null;
|
return marker.wptPt != null || marker.favouritePoint != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInMotion(@NonNull MapMarker marker) {
|
private boolean isInMotion(@NonNull MapMarker marker) {
|
||||||
|
|
Loading…
Reference in a new issue