Change rect to circle
This commit is contained in:
parent
67e39591e9
commit
94f76451b1
3 changed files with 26 additions and 60 deletions
|
@ -297,7 +297,7 @@ public class TrackDetailsMenu {
|
|||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
||||
}
|
||||
location = new LatLon(wpt.lat, wpt.lon);
|
||||
List<Pair<String, WptPt>> xAxisPoints = getXAxisPoints(chart);
|
||||
List<WptPt> xAxisPoints = getXAxisPoints(chart);
|
||||
trackChartPoints.setHighlightedPoint(location);
|
||||
trackChartPoints.setXAxisPoints(xAxisPoints);
|
||||
if (gpxItem.route) {
|
||||
|
@ -312,13 +312,12 @@ public class TrackDetailsMenu {
|
|||
fitTrackOnMap(chart, location, forceFit);
|
||||
}
|
||||
|
||||
private List<Pair<String, WptPt>> getXAxisPoints(LineChart chart) {
|
||||
List<Pair<String, WptPt>> xAxisPoints = new ArrayList<>();
|
||||
private List<WptPt> getXAxisPoints(LineChart chart) {
|
||||
List<WptPt> xAxisPoints = new ArrayList<>();
|
||||
float[] entries = chart.getXAxis().mEntries;
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
String formattedEntry = chart.getXAxis().getValueFormatter().getFormattedValue(entries[i], chart.getXAxis());
|
||||
WptPt pointToAdd = getPoint(chart, entries[i]);
|
||||
xAxisPoints.add(new Pair<>(formattedEntry, pointToAdd));
|
||||
xAxisPoints.add(pointToAdd);
|
||||
}
|
||||
return xAxisPoints;
|
||||
}
|
||||
|
@ -586,12 +585,12 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
|
||||
public class TrackChartPoints {
|
||||
private List<Pair<String, WptPt>> xAxisPoints;
|
||||
private List<WptPt> xAxisPoints;
|
||||
private LatLon highlightedPoint;
|
||||
private int segmentColor;
|
||||
private GPXFile gpx;
|
||||
|
||||
public List<Pair<String, WptPt>> getXAxisPoints() {
|
||||
public List<WptPt> getXAxisPoints() {
|
||||
return xAxisPoints;
|
||||
}
|
||||
|
||||
|
@ -607,7 +606,7 @@ public class TrackDetailsMenu {
|
|||
return gpx;
|
||||
}
|
||||
|
||||
public void setXAxisPoints(List<Pair<String, WptPt>> xAxisPoints) {
|
||||
public void setXAxisPoints(List<WptPt> xAxisPoints) {
|
||||
this.xAxisPoints = xAxisPoints;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,12 +86,10 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
|
||||
private Paint paintInnerCircle;
|
||||
|
||||
private Paint paintInnerRect;
|
||||
private Paint paintGridCircle;
|
||||
|
||||
private Paint paintTextIcon;
|
||||
|
||||
private Paint paintGridTextIcon;
|
||||
|
||||
private OsmandRenderer osmandRenderer;
|
||||
|
||||
private List<TrkSegment> points;
|
||||
|
@ -141,12 +139,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
paintTextIcon.setColor(Color.BLACK);
|
||||
paintTextIcon.setAntiAlias(true);
|
||||
|
||||
paintGridTextIcon = new Paint();
|
||||
paintGridTextIcon.setTextAlign(Align.CENTER);
|
||||
paintGridTextIcon.setFakeBoldText(true);
|
||||
paintGridTextIcon.setColor(Color.WHITE);
|
||||
paintGridTextIcon.setAntiAlias(true);
|
||||
|
||||
textLayer = view.getLayerByClass(MapTextLayer.class);
|
||||
|
||||
paintOuter = new Paint();
|
||||
|
@ -157,9 +149,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
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);
|
||||
|
||||
paintIcon = new Paint();
|
||||
pointSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_shield_small);
|
||||
|
@ -397,28 +389,19 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
}
|
||||
trackChartPoints.setSegmentColor(color);
|
||||
}
|
||||
paintInnerRect.setColor(color);
|
||||
paintGridCircle.setColor(color);
|
||||
QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
List<Pair<String, WptPt>> xAxisPoints = trackChartPoints.getXAxisPoints();
|
||||
float r = 12 * tileBox.getDensity();
|
||||
paintGridTextIcon.setTextSize(r);
|
||||
List<WptPt> xAxisPoints = trackChartPoints.getXAxisPoints();
|
||||
float r = 3 * tileBox.getDensity();
|
||||
for (int i = 0; i < xAxisPoints.size(); i++) {
|
||||
WptPt axisPoint = xAxisPoints.get(i).second;
|
||||
WptPt axisPoint = xAxisPoints.get(i);
|
||||
if (axisPoint.getLatitude() >= latLonBounds.bottom
|
||||
&& axisPoint.getLatitude() <= latLonBounds.top
|
||||
&& axisPoint.getLongitude() >= latLonBounds.left
|
||||
&& axisPoint.getLongitude() <= latLonBounds.right) {
|
||||
String textOnPoint = xAxisPoints.get(i).first;
|
||||
float textWidth = paintGridTextIcon.measureText(textOnPoint);
|
||||
float x = tileBox.getPixXFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
|
||||
float y = tileBox.getPixYFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
|
||||
canvas.drawRect(
|
||||
x - textWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y - r / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
x + textWidth / 2 + 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y + r / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||
paintInnerRect);
|
||||
canvas.drawText(textOnPoint, x, y + r / 2, paintGridTextIcon);
|
||||
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), paintGridCircle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
|
||||
private Paint paintIcon;
|
||||
private Paint paintIconAction;
|
||||
private Paint paintGridTextIcon;
|
||||
private Paint paintInnerRect;
|
||||
private Paint paintGridCircle;
|
||||
|
||||
private Paint paintIconSelected;
|
||||
private Bitmap selectedPoint;
|
||||
|
@ -80,12 +79,6 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
paintIcon.setColor(Color.BLACK);
|
||||
paintIcon.setStrokeWidth(3);
|
||||
|
||||
paintGridTextIcon = new Paint();
|
||||
paintGridTextIcon.setTextAlign(Paint.Align.CENTER);
|
||||
paintGridTextIcon.setFakeBoldText(true);
|
||||
paintGridTextIcon.setColor(Color.WHITE);
|
||||
paintGridTextIcon.setAntiAlias(true);
|
||||
|
||||
paintIconAction = new Paint();
|
||||
paintIconAction.setFilterBitmap(true);
|
||||
paintIconAction.setAntiAlias(true);
|
||||
|
@ -103,10 +96,10 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
paintIconSelected = new Paint();
|
||||
selectedPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_default_location);
|
||||
|
||||
paintInnerRect = new Paint();
|
||||
paintInnerRect.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
paintInnerRect.setAntiAlias(true);
|
||||
paintInnerRect.setColor(attrs.defaultColor);
|
||||
paintGridCircle = new Paint();
|
||||
paintGridCircle.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
paintGridCircle.setAntiAlias(true);
|
||||
paintGridCircle.setColor(attrs.defaultColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,26 +170,17 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
|
||||
private void drawXAxisPoints(Canvas canvas, RotatedTileBox tileBox) {
|
||||
QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
List<Pair<String, WptPt>> xAxisPoints = trackChartPoints.getXAxisPoints();
|
||||
float r = 12 * tileBox.getDensity();
|
||||
paintGridTextIcon.setTextSize(r);
|
||||
List<WptPt> xAxisPoints = trackChartPoints.getXAxisPoints();
|
||||
float r = 3 * tileBox.getDensity();
|
||||
for (int i = 0; i < xAxisPoints.size(); i++) {
|
||||
WptPt axisPoint = xAxisPoints.get(i).second;
|
||||
WptPt axisPoint = xAxisPoints.get(i);
|
||||
if (axisPoint.getLatitude() >= latLonBounds.bottom
|
||||
&& axisPoint.getLatitude() <= latLonBounds.top
|
||||
&& axisPoint.getLongitude() >= latLonBounds.left
|
||||
&& axisPoint.getLongitude() <= latLonBounds.right) {
|
||||
String textOnPoint = xAxisPoints.get(i).first;
|
||||
float textWidth = paintGridTextIcon.measureText(textOnPoint);
|
||||
float x = tileBox.getPixXFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
|
||||
float y = tileBox.getPixYFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
|
||||
canvas.drawRect(
|
||||
x - textWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y - r / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
x + textWidth / 2 + 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y + r / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||
paintInnerRect);
|
||||
canvas.drawText(textOnPoint, x, y + r / 2, paintGridTextIcon);
|
||||
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), paintGridCircle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue