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