Change rect color in split

This commit is contained in:
PavelRatushny 2017-06-16 18:55:06 +03:00
parent 7675977a48
commit 666061081a

View file

@ -81,9 +81,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
private Map<WptPt, SelectedGpxFile> pointFileMap = new HashMap<>();
private MapTextLayer textLayer;
private Paint paintOuter;
private Paint paintInnerCircle;
private Paint paintInnerRect;
private Paint paintGridCircle;
@ -135,19 +133,14 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
paintTextIcon.setTextSize(10 * view.getDensity());
paintTextIcon.setTextAlign(Align.CENTER);
paintTextIcon.setFakeBoldText(true);
paintTextIcon.setColor(Color.BLACK);
paintTextIcon.setColor(Color.WHITE);
paintTextIcon.setAntiAlias(true);
textLayer = view.getLayerByClass(MapTextLayer.class);
paintOuter = new Paint();
paintOuter.setColor(0x88555555);
paintOuter.setAntiAlias(true);
paintOuter.setStyle(Style.FILL_AND_STROKE);
paintInnerCircle = new Paint();
paintInnerCircle.setStyle(Style.FILL_AND_STROKE);
paintInnerCircle.setColor(0xddFFFFFF);
paintInnerCircle.setAntiAlias(true);
paintInnerRect = new Paint();
paintInnerRect.setStyle(Style.FILL_AND_STROKE);
paintInnerRect.setAntiAlias(true);
paintGridCircle = new Paint();
paintGridCircle.setStyle(Style.FILL_AND_STROKE);
paintGridCircle.setAntiAlias(true);
@ -187,6 +180,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
if (!selectedGPXFiles.isEmpty()) {
drawSelectedFilesSegments(canvas, tileBox, selectedGPXFiles, settings);
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
if (trackChartPoints != null) {
drawXAxisPoints(canvas, tileBox);
}
drawSelectedFilesSplits(canvas, tileBox, selectedGPXFiles, settings);
drawSelectedFilesPoints(canvas, tileBox, selectedGPXFiles);
}
@ -269,6 +265,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
List<GpxDisplayGroup> groups = g.getDisplayGroups();
if (groups != null) {
for (GpxDisplayGroup group : groups) {
int color = g.getModifiableGpxFile().getColor(0);
if (color == 0 || color == Color.RED) {
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
color = gpxDataItem.getColor();
}
paintInnerRect.setColor(color);
paintInnerRect.setAlpha(179);
List<GpxDisplayItem> items = group.getModifiableList();
drawSplitItems(canvas, tileBox, items, settings);
}
@ -280,6 +283,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
private void drawSplitItems(Canvas canvas, RotatedTileBox tileBox, List<GpxDisplayItem> items, DrawSettings settings) {
final QuadRect latLonBounds = tileBox.getLatLonBounds();
int r = (int) (12 * tileBox.getDensity());
paintTextIcon.setTextSize(r);
int dr = r * 3 / 2;
int px = -1;
int py = -1;
@ -303,9 +307,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
if (ind > 0) {
nm = nm.substring(0, ind);
}
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), paintOuter);
canvas.drawCircle(x, y, r - (float) Math.ceil(tileBox.getDensity()), paintInnerCircle);
paintTextIcon.setTextSize(r);
float nmWidth = paintTextIcon.measureText(nm);
canvas.drawRect(
x - nmWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
y - r / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
x + nmWidth / 2 + 2 * (float) Math.ceil(tileBox.getDensity()),
y + r / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
paintInnerRect);
canvas.drawText(nm, x, y + r / 2, paintTextIcon);
}
}
@ -355,7 +363,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
}
}
if (trackChartPoints != null) {
drawXAxisPoints(canvas, tileBox);
LatLon highlightedPoint = trackChartPoints.getHighlightedPoint();
if (highlightedPoint.getLatitude() >= latLonBounds.bottom
&& highlightedPoint.getLatitude() <= latLonBounds.top