Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
159a9a46f1
3 changed files with 60 additions and 77 deletions
|
@ -2,7 +2,6 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.util.Pair;
|
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -11,6 +10,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
import com.github.mikephil.charting.components.YAxis;
|
||||||
import com.github.mikephil.charting.data.Entry;
|
import com.github.mikephil.charting.data.Entry;
|
||||||
import com.github.mikephil.charting.data.LineData;
|
import com.github.mikephil.charting.data.LineData;
|
||||||
import com.github.mikephil.charting.highlight.Highlight;
|
import com.github.mikephil.charting.highlight.Highlight;
|
||||||
|
@ -18,6 +18,7 @@ import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||||
import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
|
import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
|
||||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
|
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
|
@ -286,8 +287,19 @@ public class TrackDetailsMenu {
|
||||||
private void refreshChart(LineChart chart, boolean forceFit) {
|
private void refreshChart(LineChart chart, boolean forceFit) {
|
||||||
Highlight[] highlights = chart.getHighlighted();
|
Highlight[] highlights = chart.getHighlighted();
|
||||||
LatLon location = null;
|
LatLon location = null;
|
||||||
|
|
||||||
|
ViewPortHandler handler = chart.getViewPortHandler();
|
||||||
|
float minimumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentLeft(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
||||||
|
float maximumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentRight(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
||||||
|
|
||||||
if (highlights != null && highlights.length > 0) {
|
if (highlights != null && highlights.length > 0) {
|
||||||
gpxItem.chartHighlightPos = highlights[0].getX();
|
if (highlights[0].getX() < minimumVisibleXValue) {
|
||||||
|
gpxItem.chartHighlightPos = minimumVisibleXValue;
|
||||||
|
} else if (highlights[0].getX() > maximumVisibleXValue) {
|
||||||
|
gpxItem.chartHighlightPos = maximumVisibleXValue;
|
||||||
|
} else {
|
||||||
|
gpxItem.chartHighlightPos = highlights[0].getX();
|
||||||
|
}
|
||||||
WptPt wpt = getPoint(chart, gpxItem.chartHighlightPos);
|
WptPt wpt = getPoint(chart, gpxItem.chartHighlightPos);
|
||||||
if (wpt != null) {
|
if (wpt != null) {
|
||||||
if (trackChartPoints == null) {
|
if (trackChartPoints == null) {
|
||||||
|
@ -297,7 +309,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 +324,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 +597,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 +618,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.util.Pair;
|
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
@ -82,15 +81,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
private Map<WptPt, SelectedGpxFile> pointFileMap = new HashMap<>();
|
private Map<WptPt, SelectedGpxFile> pointFileMap = new HashMap<>();
|
||||||
private MapTextLayer textLayer;
|
private MapTextLayer textLayer;
|
||||||
|
|
||||||
private Paint paintOuter;
|
|
||||||
|
|
||||||
private Paint paintInnerCircle;
|
|
||||||
|
|
||||||
private Paint paintInnerRect;
|
private Paint paintInnerRect;
|
||||||
|
|
||||||
private Paint paintTextIcon;
|
private Paint paintGridCircle;
|
||||||
|
|
||||||
private Paint paintGridTextIcon;
|
private Paint paintTextIcon;
|
||||||
|
|
||||||
private OsmandRenderer osmandRenderer;
|
private OsmandRenderer osmandRenderer;
|
||||||
|
|
||||||
|
@ -138,28 +133,17 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
paintTextIcon.setTextSize(10 * view.getDensity());
|
paintTextIcon.setTextSize(10 * view.getDensity());
|
||||||
paintTextIcon.setTextAlign(Align.CENTER);
|
paintTextIcon.setTextAlign(Align.CENTER);
|
||||||
paintTextIcon.setFakeBoldText(true);
|
paintTextIcon.setFakeBoldText(true);
|
||||||
paintTextIcon.setColor(Color.BLACK);
|
paintTextIcon.setColor(Color.WHITE);
|
||||||
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.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 = new Paint();
|
||||||
paintInnerRect.setStyle(Style.FILL_AND_STROKE);
|
paintInnerRect.setStyle(Style.FILL_AND_STROKE);
|
||||||
paintInnerRect.setAntiAlias(true);
|
paintInnerRect.setAntiAlias(true);
|
||||||
|
paintGridCircle = new Paint();
|
||||||
|
paintGridCircle.setStyle(Style.FILL_AND_STROKE);
|
||||||
|
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);
|
||||||
|
@ -196,6 +180,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
if (!selectedGPXFiles.isEmpty()) {
|
if (!selectedGPXFiles.isEmpty()) {
|
||||||
drawSelectedFilesSegments(canvas, tileBox, selectedGPXFiles, settings);
|
drawSelectedFilesSegments(canvas, tileBox, selectedGPXFiles, settings);
|
||||||
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
||||||
|
if (trackChartPoints != null) {
|
||||||
|
drawXAxisPoints(canvas, tileBox);
|
||||||
|
}
|
||||||
drawSelectedFilesSplits(canvas, tileBox, selectedGPXFiles, settings);
|
drawSelectedFilesSplits(canvas, tileBox, selectedGPXFiles, settings);
|
||||||
drawSelectedFilesPoints(canvas, tileBox, selectedGPXFiles);
|
drawSelectedFilesPoints(canvas, tileBox, selectedGPXFiles);
|
||||||
}
|
}
|
||||||
|
@ -278,6 +265,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
||||||
if (groups != null) {
|
if (groups != null) {
|
||||||
for (GpxDisplayGroup group : groups) {
|
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();
|
List<GpxDisplayItem> items = group.getModifiableList();
|
||||||
drawSplitItems(canvas, tileBox, items, settings);
|
drawSplitItems(canvas, tileBox, items, settings);
|
||||||
}
|
}
|
||||||
|
@ -289,6 +283,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
private void drawSplitItems(Canvas canvas, RotatedTileBox tileBox, List<GpxDisplayItem> items, DrawSettings settings) {
|
private void drawSplitItems(Canvas canvas, RotatedTileBox tileBox, List<GpxDisplayItem> items, DrawSettings settings) {
|
||||||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||||
int r = (int) (12 * tileBox.getDensity());
|
int r = (int) (12 * tileBox.getDensity());
|
||||||
|
paintTextIcon.setTextSize(r);
|
||||||
int dr = r * 3 / 2;
|
int dr = r * 3 / 2;
|
||||||
int px = -1;
|
int px = -1;
|
||||||
int py = -1;
|
int py = -1;
|
||||||
|
@ -312,9 +307,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
if (ind > 0) {
|
if (ind > 0) {
|
||||||
nm = nm.substring(0, ind);
|
nm = nm.substring(0, ind);
|
||||||
}
|
}
|
||||||
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), paintOuter);
|
float nmWidth = paintTextIcon.measureText(nm);
|
||||||
canvas.drawCircle(x, y, r - (float) Math.ceil(tileBox.getDensity()), paintInnerCircle);
|
canvas.drawRect(
|
||||||
paintTextIcon.setTextSize(r);
|
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);
|
canvas.drawText(nm, x, y + r / 2, paintTextIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +363,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trackChartPoints != null) {
|
if (trackChartPoints != null) {
|
||||||
drawXAxisPoints(canvas, tileBox);
|
|
||||||
LatLon highlightedPoint = trackChartPoints.getHighlightedPoint();
|
LatLon highlightedPoint = trackChartPoints.getHighlightedPoint();
|
||||||
if (highlightedPoint.getLatitude() >= latLonBounds.bottom
|
if (highlightedPoint.getLatitude() >= latLonBounds.bottom
|
||||||
&& highlightedPoint.getLatitude() <= latLonBounds.top
|
&& highlightedPoint.getLatitude() <= latLonBounds.top
|
||||||
|
@ -397,28 +395,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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.graphics.Path;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.PorterDuff.Mode;
|
import android.graphics.PorterDuff.Mode;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.support.v4.util.Pair;
|
|
||||||
|
|
||||||
public class RouteLayer extends OsmandMapLayer {
|
public class RouteLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
|
@ -52,8 +51,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 +78,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 +95,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 +169,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