Change user point icons for multi profile mode
This commit is contained in:
parent
14209dbd01
commit
68af54e140
2 changed files with 26 additions and 28 deletions
|
@ -271,10 +271,10 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
List<WptPt> beforePoints = editingCtx.getBeforePoints();
|
||||
List<WptPt> afterPoints = editingCtx.getAfterPoints();
|
||||
if (beforePoints.size() > 0) {
|
||||
drawPointIcon(canvas, tb, beforePoints.get(beforePoints.size() - 1));
|
||||
drawPointIcon(canvas, tb, beforePoints.get(beforePoints.size() - 1), true);
|
||||
}
|
||||
if (afterPoints.size() > 0) {
|
||||
drawPointIcon(canvas, tb, afterPoints.get(0));
|
||||
drawPointIcon(canvas, tb, afterPoints.get(0), true);
|
||||
}
|
||||
|
||||
if (editingCtx.getSelectedPointPosition() != -1) {
|
||||
|
@ -321,25 +321,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
}
|
||||
if (overlapped) {
|
||||
WptPt pt = points.get(0);
|
||||
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||
}
|
||||
drawPointIcon(canvas, tb, pt, false);
|
||||
pt = points.get(points.size() - 1);
|
||||
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||
}
|
||||
drawPointIcon(canvas, tb, pt, false);
|
||||
} else {
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
WptPt pt = points.get(i);
|
||||
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||
}
|
||||
drawPointIcon(canvas, tb, pt, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,14 +392,23 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
}
|
||||
|
||||
private void drawPointIcon(Canvas canvas, RotatedTileBox tb, WptPt pt) {
|
||||
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
private void drawPointIcon(Canvas canvas, RotatedTileBox tb, WptPt pt, boolean rotate) {
|
||||
if (rotate) {
|
||||
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
}
|
||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||
if (tb.containsPoint(locX, locY, 0)) {
|
||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||
if (editingCtx.isInMultiProfileMode()) {
|
||||
canvas.drawBitmap(multiProfileGeometryWayContext.getPointIcon(), locX - multiProfileGeometryWayContext.pointIconSize / 2,
|
||||
locY - multiProfileGeometryWayContext.pointIconSize / 2, bitmapPaint);
|
||||
} else {
|
||||
if (tb.containsPoint(locX, locY, 0)) {
|
||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||
}
|
||||
}
|
||||
if (rotate) {
|
||||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
}
|
||||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||
}
|
||||
|
||||
public WptPt addCenterPoint(boolean addPointBefore) {
|
||||
|
|
|
@ -24,6 +24,7 @@ public class MultiProfileGeometryWayContext extends GeometryWayContext {
|
|||
|
||||
public final float minIconMargin;
|
||||
public final float circleSize;
|
||||
public final float pointIconSize;
|
||||
|
||||
private RenderingLineAttributes multiProfileAttrs;
|
||||
|
||||
|
@ -36,6 +37,7 @@ public class MultiProfileGeometryWayContext extends GeometryWayContext {
|
|||
profileIconsBitmapCache = new HashMap<>();
|
||||
minIconMargin = density * 30;
|
||||
circleSize = density * 70;
|
||||
pointIconSize = density * 22f;
|
||||
}
|
||||
|
||||
public void updatePaints(boolean nightMode, @NonNull RenderingLineAttributes multiProfileAttrs) {
|
||||
|
@ -46,13 +48,12 @@ public class MultiProfileGeometryWayContext extends GeometryWayContext {
|
|||
@Override
|
||||
protected void recreateBitmaps() {
|
||||
float density = getDensity();
|
||||
float size = density * 12.5f;
|
||||
float outerRadius = density * 6.25f;
|
||||
float centerRadius = density * 6;
|
||||
float innerRadius = density * 4;
|
||||
float centerXY = size / 2;
|
||||
float outerRadius = density * 11f;
|
||||
float centerRadius = density * 10.5f;
|
||||
float innerRadius = density * 6.5f;
|
||||
float centerXY = pointIconSize / 2;
|
||||
|
||||
pointIcon = Bitmap.createBitmap((int) size, (int) size, Bitmap.Config.ARGB_8888);
|
||||
pointIcon = Bitmap.createBitmap((int) pointIconSize, (int) pointIconSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(pointIcon);
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
|
|
Loading…
Reference in a new issue